Skip to main content
Glama
emmron
by emmron

mcp__gemini__debug_master

Debug and analyze code errors with step-by-step insights, execution simulation, and fix validation. Supports multiple languages for efficient troubleshooting in development workflows.

Instructions

Advanced debugging with execution simulation, fix validation, and step-by-step analysis

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoCode where error occurs
contextNoAdditional context
error_messageYesError message or description
languageNoProgramming languagejavascript
simulate_executionNoEnable execution simulation
stack_traceNoStack trace if available

Implementation Reference

  • The main execution handler for the 'mcp__gemini__debug_master' tool. It processes error messages, code, stack traces, and context to provide root cause analysis, optional execution simulation, fix suggestions, and validation guidance using AI calls.
        handler: async (args) => {
          const { error_message, code, stack_trace, context = '', language = 'javascript', simulate_execution = true } = args;
          validateString(error_message, 'error_message');
          
          const timer = performanceMonitor.startTimer('debug_master');
          
          let debugPrompt = `Advanced debugging analysis for ${language} error:
    
    **Error**: ${error_message}
    
    ${stack_trace ? `**Stack Trace**:\n\`\`\`\n${stack_trace}\n\`\`\`\n` : ''}
    
    ${code ? `**Code Context**:\n\`\`\`${language}\n${code}\n\`\`\`\n` : ''}
    
    ${context ? `**Additional Context**: ${context}\n` : ''}
    
    Provide comprehensive debugging analysis:
    
    1. **Root Cause Analysis**
       - Primary cause identification
       - Contributing factors
       - Error propagation path
    
    2. **Code Flow Analysis**
       - Execution path leading to error
       - Variable states at error point
       - Control flow issues
    
    3. **Debugging Strategy**
       - Step-by-step debugging approach
       - Key checkpoints to examine
       - Data points to verify
    
    4. **Fix Solutions**
       - Primary fix with code example
       - Alternative approaches
       - Prevention strategies
    
    5. **Testing Validation**
       - How to verify the fix
       - Edge cases to test
       - Regression testing points
    
    Be specific and actionable.`;
    
          const analysis = await aiClient.call(debugPrompt, 'debug', { maxTokens: 3000 });
          
          let result = `šŸ› **Debug Master Analysis** (${language})
    
    ${analysis}`;
    
          // Execution simulation if enabled and code is provided
          if (simulate_execution && code) {
            const simulationPrompt = `Simulate the execution of this code step by step:
    
    \`\`\`${language}
    ${code}
    \`\`\`
    
    Error: ${error_message}
    
    Provide:
    1. **Step-by-step execution trace**
       - Line-by-line execution flow
       - Variable values at each step
       - Function calls and returns
    
    2. **Error Point Analysis**
       - Exact line where error occurs
       - Variable states at error
       - Memory/scope situation
    
    3. **Execution Scenarios**
       - Normal execution path
       - Error-triggering scenario
       - Edge case behaviors
    
    4. **State Verification**
       - Expected vs actual values
       - Assumption violations
       - Boundary condition issues
    
    Format as a detailed execution trace.`;
    
            const simulation = await aiClient.call(simulationPrompt, 'analysis');
            
            result += `
    
    ---
    
    šŸ”„ **Execution Simulation**
    
    ${simulation}`;
          }
          
          // Generate fix validation
          if (code) {
            const validationPrompt = `Based on the debugging analysis, validate potential fixes:
    
    Original Code:
    \`\`\`${language}
    ${code}
    \`\`\`
    
    Error: ${error_message}
    
    Provide:
    1. **Fix Validation Checklist**
       - Critical points to verify
       - Test cases to validate
       - Edge conditions to check
    
    2. **Regression Risk Assessment**
       - Areas that might be affected
       - Side effects to monitor
       - Backward compatibility concerns
    
    3. **Monitoring Recommendations**
       - What to watch after deployment
       - Logging improvements
       - Alert configurations`;
    
            const validation = await aiClient.call(validationPrompt, 'review');
            
            result += `
    
    ---
    
    āœ… **Fix Validation Guide**
    
    ${validation}`;
          }
          
          timer.end();
          return result;
        }
  • The input parameters schema defining the expected arguments for the tool, including required error_message and optional fields like code, stack_trace, etc.
    parameters: {
      error_message: { type: 'string', description: 'Error message or description', required: true },
      code: { type: 'string', description: 'Code where error occurs' },
      stack_trace: { type: 'string', description: 'Stack trace if available' },
      context: { type: 'string', description: 'Additional context' },
      language: { type: 'string', description: 'Programming language', default: 'javascript' },
      simulate_execution: { type: 'boolean', description: 'Enable execution simulation', default: true }
    },
  • The registration code that imports and registers all tools from the enhancedTools module, which includes 'mcp__gemini__debug_master', by calling registerToolsFromModule(enhancedTools).
    this.registerToolsFromModule(codeTools);
    this.registerToolsFromModule(analysisTools);
    this.registerToolsFromModule(enhancedTools);
    this.registerToolsFromModule(businessTools);
    this.registerToolsFromModule(licenseTools);
  • Import statement that brings in the enhancedTools object containing the definition of 'mcp__gemini__debug_master'.
    import { enhancedTools } from './enhanced-tools.js';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/emmron/gemini-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server