suggest_improvements
Analyze documentation to identify gaps and suggest improvements, including templates for missing content and enhancements for incomplete sections.
Instructions
Analyze existing documentation and suggest improvements, including templates for missing docs and enhancements for incomplete documentation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path to file or directory to analyze | |
| limit | No | Maximum number of suggestions to return |
Implementation Reference
- src/tools/suggest-improvements.ts:12-57 (handler)The core handler function for the 'suggest_improvements' tool. Analyzes the codebase path, generates improvement suggestions for documentation using analyzer and suggester, sorts by severity, applies limit, and returns structured results with error handling.export async function suggestImprovements(input: SuggestImprovementsInput) { 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 suggester = new ImprovementSuggester(); const allSuggestions = suggester.generateSuggestions(results); // Sort by severity and take top N const sorted = allSuggestions.sort((a, b) => { const severityWeight = { critical: 3, medium: 2, low: 1 }; return severityWeight[b.severity] - severityWeight[a.severity]; }); const limited = sorted.slice(0, input.limit); return { success: true, totalSuggestions: allSuggestions.length, returned: limited.length, suggestions: limited.map(s => ({ file: s.element.filePath, line: s.element.line, type: s.element.type, name: s.element.name, severity: s.severity, reason: s.reason, currentDoc: s.currentDoc, suggestedDoc: s.suggestedDoc, signature: s.element.signature })) }; } catch (error) { return { success: false, error: (error as Error).message }; } }
- Zod input schema for the tool defining 'path' (string) and 'limit' (number, 1-100, default 20).export const SuggestImprovementsSchema = z.object({ path: z.string().describe('Path to file or directory to analyze'), limit: z.number().min(1).max(100).default(20).describe('Maximum number of suggestions to return') });
- src/index.ts:62-66 (registration)Tool registration in the TOOLS array used by the MCP server, specifying name, description, and input schema.{ name: 'suggest_improvements', description: 'Analyze existing documentation and suggest improvements, including templates for missing docs and enhancements for incomplete documentation.', inputSchema: SuggestImprovementsSchema }