Skip to main content
Glama
TheAlchemist6

CodeCompass MCP

suggest_improvements

Analyze GitHub repositories to provide AI-powered improvement suggestions for code modernization, performance, maintainability, and security with actionable refactoring recommendations.

Instructions

💡 AI-powered improvement suggestions providing strategic refactoring recommendations, modernization plans, and architectural enhancements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesGitHub repository URL
file_pathsNoSpecific files to analyze for improvements (optional - analyzes key files if not specified)
improvement_goalsNoGoals for improvement suggestions
target_frameworkNoTarget framework for improvement suggestions
optionsNo

Implementation Reference

  • Main execution handler for the suggest_improvements tool. Fetches repository data and files, then calls OpenAI service to generate refactoring suggestions.
    async function handleSuggestImprovements(args: any) {
      try {
        const { url, file_paths, refactoring_goals = ['modernize', 'maintainability'], target_framework, options = {} } = args;
        
        // Get repository info and code content
        const repoInfo = await githubService.getRepositoryInfo(url);
        let filesToRefactor: Record<string, string> = {};
        
        if (file_paths && file_paths.length > 0) {
          // Get specific files
          for (const filePath of file_paths) {
            try {
              const content = await githubService.getFileContent(url, filePath);
              filesToRefactor[filePath] = content;
            } catch (error) {
              // Skip files that can't be fetched
            }
          }
        } else {
          // Use key files from repository
          filesToRefactor = repoInfo.keyFiles;
        }
        
        if (Object.keys(filesToRefactor).length === 0) {
          throw new Error('No files found to analyze for refactoring');
        }
        
        // Generate AI refactoring suggestions
        const targetProject = {
          framework: target_framework || 'Not specified',
          language: repoInfo.language || 'javascript',
          constraints: [],
          timeline: 'Not specified',
        };
        
        const aiSuggestionsResult = await openaiService.suggestRefactoringPlan(url, targetProject, refactoring_goals, options.ai_model);
        
        const result = {
          repository: {
            name: repoInfo.name,
            description: repoInfo.description,
            language: repoInfo.language,
            owner: repoInfo.owner,
          },
          refactoring: {
            goals: refactoring_goals,
            target_framework: target_framework,
            files_analyzed: Object.keys(filesToRefactor),
            ai_model_used: aiSuggestionsResult.modelUsed,
            ai_model_requested: options.ai_model || 'auto',
            suggestions: aiSuggestionsResult.content,
            priority_level: options.priority_level || 'medium',
            timestamp: new Date().toISOString(),
            model_warning: aiSuggestionsResult.warning,
          },
          metadata: {
            file_count: Object.keys(filesToRefactor).length,
            total_lines: Object.values(filesToRefactor).reduce((sum, content) => sum + content.split('\n').length, 0),
            estimated_effort: options.estimate_effort ? 'Will be provided by AI' : null,
          },
        };
        
        const response = createResponse(result);
        return formatToolResponse(response);
      } catch (error) {
        const response = createResponse(null, error);
        return formatToolResponse(response);
      }
    }
  • Input schema and tool definition for suggest_improvements, including parameters for repository URL, files, goals, and options.
    {
      name: 'suggest_improvements',
      description: '💡 AI-powered improvement suggestions providing strategic refactoring recommendations, modernization plans, and architectural enhancements.',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'GitHub repository URL',
          },
          file_paths: {
            type: 'array',
            items: { type: 'string' },
            description: 'Specific files to analyze for improvements (optional - analyzes key files if not specified)',
          },
          improvement_goals: {
            type: 'array',
            items: {
              type: 'string',
              enum: ['modernize', 'performance', 'maintainability', 'security', 'readability', 'testability'],
            },
            description: 'Goals for improvement suggestions',
            default: ['modernize', 'maintainability'],
          },
          target_framework: {
            type: 'string',
            description: 'Target framework for improvement suggestions',
          },
          options: {
            type: 'object',
            properties: {
              ai_model: {
                type: 'string',
                description: 'AI model to use for suggestions (OpenRouter models). Use "auto" for intelligent model selection',
                default: 'auto',
              },
              include_code_examples: {
                type: 'boolean',
                description: 'Include before/after code examples',
                default: true,
              },
              priority_level: {
                type: 'string',
                enum: ['low', 'medium', 'high'],
                description: 'Minimum priority level for suggestions',
                default: 'medium',
              },
              estimate_effort: {
                type: 'boolean',
                description: 'Include effort estimates for improvement tasks',
                default: true,
              },
            },
          },
        },
        required: ['url'],
      },
    },
  • src/index.ts:236-240 (registration)
    Tool registration via returning consolidatedTools (which includes suggest_improvements) in ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: consolidatedTools,
      };
    });
  • src/index.ts:280-282 (registration)
    Dispatcher switch case that routes calls to the suggest_improvements handler.
    case 'suggest_improvements':
      result = await handleSuggestImprovements(args);
      break;
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'AI-powered improvement suggestions' but lacks details on permissions needed, rate limits, whether it modifies code (likely read-only analysis), output format, or error handling. This is inadequate for a tool with 5 parameters and no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with an emoji for visual emphasis. It's front-loaded with the core purpose and avoids redundancy. Every word contributes to conveying the tool's function without waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, nested objects, no output schema, and no annotations), the description is insufficient. It doesn't address behavioral aspects like whether it's read-only or mutative, what the output looks like, or how it differs from siblings. For an AI-powered analysis tool with multiple inputs, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 80%, so the baseline is 3. The description adds no specific parameter semantics beyond what's in the schema—it doesn't explain relationships between parameters like how 'improvement_goals' interacts with 'target_framework' or 'options'. The schema already documents parameters well, but the description doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'AI-powered improvement suggestions providing strategic refactoring recommendations, modernization plans, and architectural enhancements.' It specifies the verb ('suggest improvements') and resource type (codebase improvements), though it doesn't explicitly differentiate from siblings like 'review_code' or 'transform_code' beyond the AI-powered aspect.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like 'review_code' or 'transform_code' is provided. The description implies usage for AI-driven improvement analysis but doesn't specify prerequisites, exclusions, or comparative contexts with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheAlchemist6/codecompass-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server