Skip to main content
Glama
Njengah
by Njengah

detect_missing_docs

Identify undocumented code elements in TypeScript, JavaScript, or Python files and categorize them by severity level to prioritize documentation efforts.

Instructions

Detect code elements that are missing documentation and categorize them by severity (critical, medium, low).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoPath to file or directory to analyze
minSeverityNoMinimum severity level to report

Implementation Reference

  • The primary handler function for the 'detect_missing_docs' tool. Analyzes the specified path using CodebaseAnalyzer, detects missing documentation with DocDetector, applies severity filtering, generates a summary, and returns structured results with success status and details.
    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
        };
      }
    }
  • Zod schema defining the input for the 'detect_missing_docs' tool: path to analyze and optional minimum severity threshold.
    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:58-61 (registration)
    Tool registration in the TOOLS array used for listing available tools, specifying name, description, and input schema.
      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)
    Dispatch handler in the CallToolRequest switch statement that validates input, calls the detectMissingDocs function, and formats the response.
    case 'detect_missing_docs': {
      const validated = DetectMissingDocsSchema.parse(args);
      const result = await detectMissingDocs(validated);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Core helper method in DocDetector class that scans analysis results for undocumented code elements, assigns severity and reasons, and sorts by priority.
    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));
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the tool categorizes by severity but doesn't explain what constitutes 'critical', 'medium', or 'low' severity, how the detection works (static analysis, heuristics), what output format to expect, or whether this is a read-only operation. Significant behavioral context is missing.

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

Conciseness5/5

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

The description is a single, efficient sentence that states the core functionality without unnecessary words. It's appropriately sized for a tool with two parameters and no complex behavioral traits to explain. Every word earns its place.

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?

For a detection/analysis tool with no annotations and no output schema, the description is insufficient. It doesn't explain what types of code elements are analyzed (functions, classes, modules), what documentation standards are expected, what the output looks like, or how results should be interpreted. The agent lacks critical context to use this 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?

Schema description coverage is 100%, so the schema already documents both parameters ('path' and 'minSeverity'). The description doesn't add any parameter-specific information beyond what's in the schema. The baseline of 3 is appropriate when the schema does the heavy lifting for parameter documentation.

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 clearly states the tool's purpose: detecting code elements missing documentation and categorizing them by severity. It specifies the verb 'detect' and the resource 'code elements', but doesn't explicitly differentiate from sibling tools like 'analyze_codebase' or 'suggest_improvements' which might have overlapping functionality.

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 like 'analyze_codebase' or 'generate_documentation'. There's no mention of prerequisites, typical use cases, or exclusions. The agent must infer usage from the tool name and description alone.

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

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