detect_missing_docs
Identify undocumented code elements in your codebase and categorize them by severity level (critical, medium, low) to prioritize documentation efforts.
Instructions
Detect code elements that are missing documentation and categorize them by severity (critical, medium, low).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| minSeverity | No | Minimum severity level to report | |
| path | No | Path to file or directory to analyze |
Implementation Reference
- src/tools/detect-missing-docs.ts:12-61 (handler)Primary handler function implementing the 'detect_missing_docs' tool: analyzes codebase path, detects missing documentation using DocDetector, filters by minSeverity, computes summary, and returns structured result.export async function detectMissingDocs(input: DetectMissingDocsInput) { try { const analyzer = new CodebaseAnalyzer(); const results = await analyzer.analyzePath(input.path); if (results.length === 0) { return { success: false, error: 'No supported source files found in the specified path' }; } const detector = new DocDetector(); const allMissing = detector.detectMissingDocs(results); // Filter by severity const severityOrder = { critical: 3, medium: 2, low: 1 }; const minLevel = severityOrder[input.minSeverity as keyof typeof severityOrder]; const filtered = allMissing.filter(m => severityOrder[m.severity as keyof typeof severityOrder] >= minLevel ); const summary = detector.getSummary(allMissing); return { success: true, summary: { total: allMissing.length, filtered: filtered.length, bySeverity: summary.bySeverity, byType: summary.byType }, missing: filtered.map(m => ({ file: m.element.filePath, line: m.element.line, type: m.element.type, name: m.element.name, severity: m.severity, reason: m.reason, signature: m.element.signature })) }; } catch (error) { return { success: false, error: (error as Error).message }; } }
- src/tools/detect-missing-docs.ts:5-8 (schema)Zod schema defining the input for the detect_missing_docs tool: path (string) and optional minSeverity (enum).export const DetectMissingDocsSchema = z.object({ path: z.string().describe('Path to file or directory to analyze'), minSeverity: z.enum(['critical', 'medium', 'low']).default('low').describe('Minimum severity level to report') });
- src/index.ts:57-61 (registration)Registration of the 'detect_missing_docs' tool in the server's TOOLS array, including name, description, and input schema reference.{ name: 'detect_missing_docs', description: 'Detect code elements that are missing documentation and categorize them by severity (critical, medium, low).', inputSchema: DetectMissingDocsSchema },
- src/index.ts:121-132 (registration)MCP CallTool request handler case for 'detect_missing_docs': parses input with schema, calls detectMissingDocs handler, returns JSON text content.case 'detect_missing_docs': { const validated = DetectMissingDocsSchema.parse(args); const result = await detectMissingDocs(validated); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/analyzers/doc-detector.ts:4-20 (helper)Core helper method in DocDetector class that iterates over analysis results, identifies elements without documentation, assigns severity and reason, and sorts by severity.detectMissingDocs(results: AnalysisResult[]): MissingDocumentation[] { const missing: MissingDocumentation[] = []; for (const result of results) { for (const element of result.elements) { if (!element.hasDocumentation) { missing.push({ element, severity: this.determineSeverity(element), reason: this.getReason(element) }); } } } return missing.sort((a, b) => this.severityWeight(b.severity) - this.severityWeight(a.severity)); }