debug_problem
Systematically debug software issues by generating hypotheses, test strategies, and resolution steps for described problems.
Instructions
Provides a systematic debugging approach for a described problem. Generates hypotheses, test strategies, and resolution steps.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| problem | Yes | Description of the problem/bug | |
| symptoms | No | Observed symptoms | |
| context | No | Environment, recent changes, etc. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"context": {
"description": "Environment, recent changes, etc.",
"type": "string"
},
"problem": {
"description": "Description of the problem/bug",
"type": "string"
},
"symptoms": {
"description": "Observed symptoms",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"problem"
],
"type": "object"
}
Implementation Reference
- src/tools/cognitive.ts:263-319 (handler)The handler function that executes the 'debug_problem' tool. It takes input args (problem, symptoms, context) and generates a comprehensive markdown debugging guide with phases, hypotheses, and tools.export function debugProblemHandler(args: any) { const { problem, symptoms = [], context = "" } = args; const debug = `# Debug Analysis: ${problem} ## Problem Statement ${problem} ## Observed Symptoms ${symptoms.length > 0 ? symptoms.map((s: string) => `- ${s}`).join("\n") : "No specific symptoms listed"} ## Context ${context || "No additional context provided"} --- ## Debugging Strategy ### Phase 1: Reproduce - [ ] Can you consistently reproduce the issue? - [ ] What are the exact steps to reproduce? - [ ] Does it happen in all environments? ### Phase 2: Isolate - [ ] What is the smallest code that shows the bug? - [ ] When did this start happening? - [ ] What changed recently? ### Phase 3: Hypotheses Based on the symptoms, possible causes: 1. **Data Issue**: Invalid input or state 2. **Logic Error**: Incorrect condition or algorithm 3. **Timing Issue**: Race condition or async problem 4. **Environment**: Configuration or dependency issue 5. **Integration**: External service or API problem ### Phase 4: Test Each Hypothesis For each hypothesis above: - Add logging/breakpoints - Check relevant data - Verify assumptions ### Phase 5: Fix & Verify - [ ] Implement minimal fix - [ ] Verify fix resolves issue - [ ] Check for regressions - [ ] Add test to prevent recurrence ## Tools to Use - Debugger (breakpoints, step-through) - Logging (add strategic log points) - Network inspector (API issues) - Profiler (performance issues) `; return { content: [{ type: "text", text: debug }] }; }
- src/tools/cognitive.ts:253-261 (schema)Zod schema definition for the 'debug_problem' tool inputs: required 'problem' string, optional 'symptoms' array and 'context' string.export const debugProblemSchema = { name: "debug_problem", description: "Provides a systematic debugging approach for a described problem. Generates hypotheses, test strategies, and resolution steps.", inputSchema: z.object({ problem: z.string().describe("Description of the problem/bug"), symptoms: z.array(z.string()).optional().describe("Observed symptoms"), context: z.string().optional().describe("Environment, recent changes, etc.") }) };
- src/server.ts:92-92 (registration)Registration of 'debug_problem' tool in the HTTP server's toolRegistry Map.["debug_problem", { schema: debugProblemSchema, handler: debugProblemHandler }],
- src/index.ts:82-82 (registration)Registration of 'debug_problem' tool in the stdio server's toolRegistry Map.["debug_problem", { schema: debugProblemSchema, handler: debugProblemHandler }],