Skip to main content
Glama
rodhayl
by rodhayl

mcp_error_explainer

Explains error messages and stack traces to identify root causes and suggest fixes for programming issues.

Instructions

Explain stack traces/errors and likely fixes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
errorYesError message or stacktrace
languageNoProgramming language (optional)
contextNoAdditional context about the code (optional)

Implementation Reference

  • The `explainError` method implements the `mcp_error_explainer` tool logic, using an LLM to analyze error messages and context to provide explanations and fixes.
      async explainError(
        errorMessage: string,
        options?: {
          stackTrace?: string;
          codeContext?: string;
          language?: string;
        }
      ): Promise<ExplainErrorResult> {
        const language = options?.language ?? 'code';
    
        const prompt = `You are an expert debugger. Analyze this error and help diagnose the root cause.
    ${options?.language ? `Language: ${options.language}` : ''}
    
    Provide your response as JSON:
    {
      "rootCause": "The fundamental cause of the error",
      "explanation": "Detailed explanation of why this error occurred",
      "suggestedFixes": [
        {
          "description": "How to fix it",
          "code": "Optional code example"
        }
      ],
      "relatedDocs": ["Links or references to relevant documentation"]
    }`;
    
        const userContent = `Error: ${errorMessage}
    ${options?.stackTrace ? `\nStack Trace:\n${options.stackTrace}` : ''}
    ${options?.codeContext ? `\nCode Context:\n\`\`\`${language}\n${options.codeContext}\n\`\`\`` : ''}`;
    
        try {
          const responseText = await this.llmWrapper.callToolLlm(
            'mcp_error_explainer',
            [
              { role: 'system', content: prompt },
              { role: 'user', content: userContent },
            ],
            { type: 'explain_error', language }
          );
    
          const parsed = this.parseJsonResponse(responseText, {
            rootCause: '',
            explanation: responseText,
            suggestedFixes: [],
          });
    
          const rawExplanation =
            typeof (parsed as any)?.explanation === 'string' ? String((parsed as any).explanation) : '';
          const fallbackExplanation = responseText?.trim() || `Error: ${errorMessage}`;
          const explanation = rawExplanation.trim() ? rawExplanation.trim() : fallbackExplanation;
    
          return {
            success: true,
            rootCause: parsed.rootCause || 'Unable to determine',
            explanation,
            suggestedFixes: parsed.suggestedFixes || [],
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. While 'explain' implies read-only operation, it fails to specify output format, whether external APIs are called, rate limits, or what 'likely fixes' entails. No disclosure of side effects or operational constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise at 9 words. Front-loaded with action and target. No redundant or filler text; every word serves the definition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given simple 3-parameter flat schema with full coverage, description is minimally sufficient for invocation. However, absence of output schema means description should ideally specify return format, which it does not.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% description coverage, establishing baseline of 3. Description adds no parameter-specific guidance (e.g., expected format for 'error', valid values for 'language') beyond what schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States specific action ('Explain') and target ('stack traces/errors and likely fixes') clearly. However, lacks explicit differentiation from sibling tools like 'code_helper' or 'find_and_fix' that might also handle errors.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides no guidance on when to use this tool versus alternatives (e.g., 'find_and_fix' which might actually modify code, or 'analyze_file' for static analysis). No prerequisites or exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/rodhayl/mcpLocalHelper'

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