suggest_improvements
Analyze documentation to identify gaps and provide actionable suggestions for improvement, 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 |
|---|---|---|---|
| limit | No | Maximum number of suggestions to return | |
| path | No | Path to file or directory to analyze |
Implementation Reference
- src/tools/suggest-improvements.ts:12-57 (handler)The primary handler function that executes the suggest_improvements tool. Analyzes the codebase path, generates improvement suggestions for documentation, sorts by severity, applies limit, and returns structured results.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 schema defining the input parameters for the suggest_improvements tool: path (required string) and limit (optional number, 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, defining name, description, and input schema for listing and validation in the MCP server.{ name: 'suggest_improvements', description: 'Analyze existing documentation and suggest improvements, including templates for missing docs and enhancements for incomplete documentation.', inputSchema: SuggestImprovementsSchema }