chat.ts•10.6 kB
import { Tool } from '@modelcontextprotocol/sdk/types.js';
export const chatTools: Tool[] = [
{
name: 'chat_with_repository',
description: 'Interactive chat about repository code, patterns, and refactoring opportunities',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL',
},
message: {
type: 'string',
description: 'Message or question about the repository',
},
context: {
type: 'object',
properties: {
currentFile: {
type: 'string',
description: 'Currently focused file path',
},
selectedCode: {
type: 'string',
description: 'Selected code snippet',
},
refactoringGoals: {
type: 'array',
items: { type: 'string' },
description: 'Current refactoring goals',
},
previousMessages: {
type: 'array',
items: {
type: 'object',
properties: {
role: { type: 'string' },
content: { type: 'string' },
timestamp: { type: 'string' },
},
required: ['role', 'content'],
},
description: 'Previous conversation messages',
},
},
},
options: {
type: 'object',
properties: {
includeCodeSuggestions: {
type: 'boolean',
description: 'Include code suggestions in response',
default: true,
},
includePatternAnalysis: {
type: 'boolean',
description: 'Include pattern analysis',
default: true,
},
includeRefactoringTips: {
type: 'boolean',
description: 'Include refactoring tips',
default: true,
},
focusArea: {
type: 'string',
enum: ['architecture', 'performance', 'maintainability', 'testing', 'security'],
description: 'Area to focus the discussion on',
},
},
},
},
required: ['url', 'message'],
},
},
{
name: 'suggest_refactoring_plan',
description: 'Generate AI-powered refactoring plan based on repository analysis',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL',
},
targetProject: {
type: 'object',
properties: {
framework: {
type: 'string',
description: 'Target framework',
},
language: {
type: 'string',
description: 'Target language',
},
constraints: {
type: 'array',
items: { type: 'string' },
description: 'Project constraints',
},
timeline: {
type: 'string',
description: 'Timeline for refactoring (e.g., "2 weeks", "1 month")',
},
},
required: ['framework'],
},
goals: {
type: 'array',
items: {
type: 'string',
enum: ['modernize', 'extract-components', 'improve-performance', 'add-types', 'improve-testing', 'reduce-complexity'],
},
description: 'Refactoring goals',
},
options: {
type: 'object',
properties: {
includeRisks: {
type: 'boolean',
description: 'Include risk analysis',
default: true,
},
includeTimeline: {
type: 'boolean',
description: 'Include timeline estimates',
default: true,
},
includePriorities: {
type: 'boolean',
description: 'Include priority recommendations',
default: true,
},
includeResources: {
type: 'boolean',
description: 'Include resource recommendations',
default: true,
},
},
},
},
required: ['url', 'targetProject'],
},
},
{
name: 'explain_architecture',
description: 'Generate detailed explanation of repository architecture and patterns',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL',
},
focusAreas: {
type: 'array',
items: {
type: 'string',
enum: ['overall', 'frontend', 'backend', 'database', 'api', 'testing', 'deployment', 'security'],
},
description: 'Areas to focus the explanation on',
},
audienceLevel: {
type: 'string',
enum: ['beginner', 'intermediate', 'advanced'],
description: 'Target audience level',
default: 'intermediate',
},
explanationOptions: {
type: 'object',
properties: {
includeCodeExamples: {
type: 'boolean',
description: 'Include code examples',
default: true,
},
includeDiagrams: {
type: 'boolean',
description: 'Include ASCII diagrams',
default: true,
},
includePatterns: {
type: 'boolean',
description: 'Include pattern explanations',
default: true,
},
includeRecommendations: {
type: 'boolean',
description: 'Include improvement recommendations',
default: true,
},
includeComparisons: {
type: 'boolean',
description: 'Include comparisons with alternatives',
default: false,
},
},
},
},
required: ['url'],
},
},
{
name: 'generate_code_review',
description: 'Generate comprehensive code review with refactoring suggestions',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL',
},
filePaths: {
type: 'array',
items: { type: 'string' },
description: 'Specific files to review (optional - reviews all if not specified)',
},
reviewCriteria: {
type: 'object',
properties: {
checkComplexity: {
type: 'boolean',
description: 'Check code complexity',
default: true,
},
checkPatterns: {
type: 'boolean',
description: 'Check for anti-patterns',
default: true,
},
checkSecurity: {
type: 'boolean',
description: 'Check for security issues',
default: true,
},
checkPerformance: {
type: 'boolean',
description: 'Check for performance issues',
default: true,
},
checkMaintainability: {
type: 'boolean',
description: 'Check maintainability',
default: true,
},
checkTestability: {
type: 'boolean',
description: 'Check testability',
default: true,
},
},
},
outputFormat: {
type: 'string',
enum: ['detailed', 'summary', 'checklist', 'markdown'],
description: 'Output format for review',
default: 'detailed',
},
},
required: ['url'],
},
},
{
name: 'ask_about_code',
description: 'Ask specific questions about code functionality, patterns, or implementation',
inputSchema: {
type: 'object',
properties: {
url: {
type: 'string',
description: 'GitHub repository URL',
},
question: {
type: 'string',
description: 'Specific question about the code',
},
scope: {
type: 'object',
properties: {
filePath: {
type: 'string',
description: 'Specific file to focus on',
},
functionName: {
type: 'string',
description: 'Specific function to focus on',
},
lineRange: {
type: 'object',
properties: {
start: { type: 'number' },
end: { type: 'number' },
},
description: 'Line range to focus on',
},
},
},
responseStyle: {
type: 'string',
enum: ['explanation', 'tutorial', 'reference', 'troubleshooting'],
description: 'Style of response',
default: 'explanation',
},
},
required: ['url', 'question'],
},
},
{
name: 'compare_implementations',
description: 'Compare different implementations and suggest the best approach',
inputSchema: {
type: 'object',
properties: {
implementations: {
type: 'array',
items: {
type: 'object',
properties: {
name: { type: 'string' },
url: { type: 'string' },
filePath: { type: 'string' },
description: { type: 'string' },
},
required: ['name', 'url', 'filePath'],
},
description: 'Different implementations to compare',
},
comparisonCriteria: {
type: 'array',
items: {
type: 'string',
enum: ['performance', 'maintainability', 'readability', 'testability', 'security', 'scalability'],
},
description: 'Criteria for comparison',
},
targetUseCase: {
type: 'string',
description: 'Target use case for the implementation',
},
outputFormat: {
type: 'string',
enum: ['table', 'detailed', 'summary', 'recommendations'],
description: 'Format for comparison output',
default: 'detailed',
},
},
required: ['implementations'],
},
},
];