debug-issue
Debug technical issues using systematic problem-solving with AI assistance. Input tasks, symptoms, and files to identify and resolve errors.
Instructions
Debug technical issues with systematic problem-solving approach
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | What to debug (e.g., 'fix login error', 'investigate memory leak') | |
| files | No | Relevant file paths (optional) | |
| symptoms | No | Error symptoms or behavior observed | |
| provider | No | AI provider to use | gemini |
Implementation Reference
- src/handlers/ai-tools.ts:401-448 (handler)Implementation of the debug-issue tool handler in AIToolHandlers class. Uses ProviderManager to select AI provider, constructs systematic debugging prompt, calls generateText, and returns structured response with metadata.async handleDebugIssue(params: z.infer<typeof DebugIssueSchema>) { // Use provided provider or get the preferred one (Azure if configured) const providerName = params.provider || (await this.providerManager.getPreferredProvider(['openai', 'gemini', 'azure'])); const provider = await this.providerManager.getProvider(providerName); const systemPrompt = `You are an expert debugger and problem solver. Help identify and solve technical issues. Approach debugging systematically: - Analyze the problem description and symptoms - Identify potential root causes - Suggest specific debugging steps - Provide solution recommendations - Consider edge cases and related issues Be methodical and provide actionable debugging guidance.`; let prompt = `Debug the following issue: ${params.task}`; if (params.symptoms) { prompt += `\n\nSymptoms observed: ${params.symptoms}`; } if (params.files) { prompt += `\n\nRelevant files: ${params.files.join(", ")}`; } const response = await provider.generateText({ prompt, systemPrompt, temperature: 0.4, // Balanced temperature for debugging creativity reasoningEffort: (providerName === "openai" || providerName === "azure" || providerName === "grok") ? "high" : undefined, useSearchGrounding: false, // No search needed for debugging }); return { content: [ { type: "text", text: response.text, }, ], metadata: { provider: providerName, model: response.model, symptoms: params.symptoms, usage: response.usage, ...response.metadata, }, }; }
- src/server.ts:48-53 (schema)Zod schema definition for debug-issue tool input validation, defining task, optional files, symptoms, and provider.const DebugIssueSchema = z.object({ task: z.string().describe("What to debug (e.g., 'fix login error', 'investigate memory leak')"), files: z.array(z.string()).optional().describe("Relevant file paths (optional)"), symptoms: z.string().optional().describe("Error symptoms or behavior observed"), provider: z.enum(["openai", "gemini", "azure", "grok"]).optional().default("gemini").describe("AI provider to use"), });
- src/server.ts:304-312 (registration)Registration of the debug-issue tool on the MCP server, specifying title, description, input schema, and handler invocation via getHandlers().// Register debug-issue tool server.registerTool("debug-issue", { title: "Debug Issue", description: "Debug technical issues with systematic problem-solving approach", inputSchema: DebugIssueSchema.shape, }, async (args) => { const aiHandlers = await getHandlers(); return await aiHandlers.handleDebugIssue(args); });
- src/server.ts:624-641 (registration)MCP prompt registration for debug-issue, providing a string-based argsSchema and message construction for prompt-based invocation.server.registerPrompt("debug-issue", { title: "Debug Issue", description: "Debug technical issues with systematic problem-solving approach", argsSchema: { task: z.string().optional(), files: z.string().optional(), symptoms: z.string().optional(), provider: z.string().optional(), }, }, (args) => ({ messages: [{ role: "user", content: { type: "text", text: `Debug this issue: ${args.task || 'Please specify what issue to debug (e.g., error message, unexpected behavior).'}${args.files ? `\n\nRelevant files: ${args.files}` : ''}${args.symptoms ? `\n\nSymptoms observed: ${args.symptoms}` : ''}${args.provider ? ` (using ${args.provider} provider)` : ''}` } }] }));