Skip to main content
Glama

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 || {});

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