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
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | File paths to analyze | |
| format | No | Output format | markdown |
Implementation Reference
- src/tools/code-quality.ts:252-262 (handler)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); }
- src/tools/code-quality.ts:138-158 (registration)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 || {});