mcp_diff_summarizer
Summarize code diffs into concise human-readable changes for easier code review and understanding of modifications.
Instructions
Summarize code diffs into concise human-readable changes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| diff | Yes | Git diff or unified diff content | |
| format | No | Output format (default: summary) |
Implementation Reference
- src/tools/code-assistance.ts:384-438 (handler)Implementation of the `explainDiff` method in `CodeAssistanceTools` class, which uses the `mcp_diff_summarizer` identifier for the tool call logic.
/** * Explain code diff in plain language */ async explainDiff( diff: string, options?: { context?: string; } ): Promise<ExplainDiffResult> { const prompt = `You are an expert at explaining code changes. Analyze this diff and explain what changed in plain English. ${options?.context ? `Context: ${options.context}` : ''} Provide your response as JSON: { "summary": "High-level summary of changes", "changes": [ { "type": "added|removed|modified", "description": "What was changed", "impact": "Why this change matters" } ], "risks": ["Any potential risks or concerns"] }`; try { const responseText = await this.llmWrapper.callToolLlm( 'mcp_diff_summarizer', [ { role: 'system', content: prompt }, { role: 'user', content: diff }, ], { type: 'explain_diff' } ); const parsed = this.parseJsonResponse(responseText, { summary: responseText, changes: [], }); return { success: true, summary: parsed.summary || '', changes: parsed.changes || [], risks: parsed.risks, }; } catch (error) { return { success: false, summary: '', changes: [], error: error instanceof Error ? error.message : 'Unknown error', }; } }