Skip to main content
Glama
code-alchemist01

Development Tools MCP Server

generate_code_metrics

Analyze code files to generate detailed metrics reports on quality, complexity, and structure in JSON or Markdown format.

Instructions

Generate detailed code metrics report

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filesYesFile paths to analyze
formatNoOutput formatmarkdown

Implementation Reference

  • The handler implementation for the 'generate_code_metrics' tool. It processes input files, analyzes code quality using CodeAnalyzer, and returns formatted metrics in JSON or Markdown format.
    case 'generate_code_metrics': {
      const files = params.files as string[];
      const format = (params.format as string) || 'markdown';
      const codeFiles = await FileReader.readFiles(files.join(','));
      const metrics = await codeAnalyzer.analyzeCodeQuality(codeFiles);
    
      if (format === 'json') {
        return metrics;
      }
      return Formatters.formatCodeQualityMetrics(metrics);
    }
  • Registration of the 'generate_code_metrics' tool in the codeQualityTools array, including its name, description, and input schema.
    {
      name: 'generate_code_metrics',
      description: 'Generate detailed code metrics report',
      inputSchema: {
        type: 'object',
        properties: {
          files: {
            type: 'array',
            items: { type: 'string' },
            description: 'File paths to analyze',
          },
          format: {
            type: 'string',
            enum: ['json', 'markdown'],
            description: 'Output format',
            default: 'markdown',
          },
        },
        required: ['files'],
      },
    },
  • src/server.ts:18-25 (registration)
    Top-level registration where codeQualityTools (including generate_code_metrics) are combined into allTools for the MCP server.
    const allTools = [
      ...codeAnalysisTools,
      ...codeQualityTools,
      ...dependencyAnalysisTools,
      ...lintingTools,
      ...webScrapingTools,
      ...apiDiscoveryTools,
    ];
  • src/server.ts:62-65 (registration)
    Dispatch logic in the MCP server that routes calls to 'generate_code_metrics' to the codeQualityTools handler.
    if (codeAnalysisTools.some((t) => t.name === name)) {
      result = await handleCodeAnalysisTool(name, args || {});
    } else if (codeQualityTools.some((t) => t.name === name)) {
      result = await handleCodeQualityTool(name, args || {});
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Generate' but doesn't clarify if this is a read-only analysis or a write operation, what permissions might be needed, how it handles large files, or what the output looks like (e.g., report structure). For a tool with no annotation coverage, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is a single, efficient sentence that states the core purpose without unnecessary words. It's appropriately sized for a simple tool, though it could be slightly more informative without losing conciseness.

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 complexity of code analysis and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'code metrics' entail (e.g., lines of code, complexity scores), how the report is structured, or any behavioral aspects like performance or limitations. This leaves the agent with insufficient context to use the tool effectively.

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?

The input schema has 100% description coverage, with clear documentation for 'files' and 'format' parameters. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain what 'code metrics' include or how file paths are interpreted). Given the high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 'Generate detailed code metrics report' clearly states the verb ('Generate') and resource ('detailed code metrics report'), making the purpose understandable. However, it doesn't distinguish this tool from its many sibling analysis tools (e.g., analyze_code_quality, calculate_complexity), which all seem to analyze code in different ways, so it lacks sibling differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. With numerous sibling tools like analyze_code_quality and calculate_complexity that likely overlap in analyzing code aspects, there's no indication of what makes 'code metrics' unique or when it's preferred, leaving the agent without usage context.

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/code-alchemist01/development-tools-mcp-Server'

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