Skip to main content
Glama
detect-missing-docs.ts1.86 kB
import { z } from 'zod'; import { CodebaseAnalyzer } from '../analyzers/codebase-analyzer.js'; import { DocDetector } from '../analyzers/doc-detector.js'; 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') }); export type DetectMissingDocsInput = z.infer<typeof DetectMissingDocsSchema>; 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 }; } }

Implementation Reference

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/Njengah/claude-4.5-mcp-tutorial'

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