Skip to main content
Glama

debug_testcase

Retrieve historical test execution data and failure analysis for a test case to diagnose problems and receive fix suggestions based on patterns across test runs.

Instructions

Fetch historical execution and failure data for a specific test case. Returns raw historical data with test run details (ID, counter, branch), test runs summary, and a debugging prompt from the API. Each execution includes its associated test run information (testRunId, testRunCounter, branch) to help correlate failures across different test runs and branches. The AI client will analyze the data to identify failure patterns, find root causes, and provide fix suggestions. Use this when you need to debug a failing test case. Example: 'Debug test case "Verify user login"'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID (Required). The TestDino project identifier.
testcase_nameYesTest case name/title to debug (Required). Example: 'Verify user can logout and login'.

Implementation Reference

  • The main handler function that executes the debug_testcase tool logic. Fetches historical test case data and debugging prompt from the API.
    export async function handleDebugTestCase(args?: DebugTestCaseArgs) {
      const token = getApiKey(args);
    
      if (!token) {
        throw new Error(
          "Missing TESTDINO_PAT (PAT) environment variable. " +
            "Please configure it in your .cursor/mcp.json file under the 'env' section."
        );
      }
    
      if (!args?.projectId) {
        throw new Error("projectId is required");
      }
    
      if (!args?.testcase_name) {
        throw new Error("testcase_name is required");
      }
    
      try {
        // Call the debug endpoint - API returns historical data and debugging_prompt
        const debugUrl = endpoints.debugTestCase({
          projectId: String(args.projectId),
          testcase_name: String(args.testcase_name),
        });
    
        const response = await apiRequestJson<unknown>(debugUrl, {
          headers: {
            Authorization: `Bearer ${token}`,
          },
        });
    
        // Return the API response (includes historical data and debugging_prompt)
        const responseText = JSON.stringify(response, null, 2);
        const content: Array<{ type: string; text: string }> = [
          { type: "text", text: responseText },
        ];
    
        // If response contains screenshot/image attachments, instruct the agent to view them
        if (
          responseText.includes('"contentType": "image/') ||
          responseText.includes('"name": "screenshot"')
        ) {
          content.push({
            type: "text",
            text: "Screenshot images are available in the historical test data above. You should fetch and view the screenshot URLs in the attempts' attachments to visually inspect the application state at the time of each failure — this is critical for accurate root cause analysis.",
          });
        }
    
        return { content };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Failed to debug test case: ${errorMessage}`);
      }
    }
  • The DebugTestCaseArgs interface and the debugTestCaseTool object with its inputSchema defining the required parameters (projectId, testcase_name).
    interface DebugTestCaseArgs {
      projectId: string;
      testcase_name: string;
    }
    
    export const debugTestCaseTool = {
      name: "debug_testcase",
      description:
        "Fetch historical execution and failure data for a specific test case. Returns raw historical data with test run details (ID, counter, branch), test runs summary, and a debugging prompt from the API. Each execution includes its associated test run information (testRunId, testRunCounter, branch) to help correlate failures across different test runs and branches. The AI client will analyze the data to identify failure patterns, find root causes, and provide fix suggestions. Use this when you need to debug a failing test case. Example: 'Debug test case \"Verify user login\"'.",
      inputSchema: {
        type: "object",
        properties: {
          projectId: {
            type: "string",
            description: "Project ID (Required). The TestDino project identifier.",
          },
          testcase_name: {
            type: "string",
            description:
              "Test case name/title to debug (Required). Example: 'Verify user can logout and login'.",
          },
        },
        required: ["projectId", "testcase_name"],
      },
    };
  • src/index.ts:105-130 (registration)
    The tool is registered in the tools array at src/index.ts and routed in the CallToolRequestSchema handler at lines 225-229.
      debugTestCaseTool,
      testAuditTool,
      listManualTestCasesTool,
      getManualTestCaseTool,
      createManualTestCaseTool,
      updateManualTestCaseTool,
      listManualTestSuitesTool,
      createManualTestSuiteTool,
      // Releases
      listReleasesTool,
      getReleaseTool,
      createReleaseTool,
      updateReleaseTool,
      // Manual runs
      listManualRunsTool,
      getManualRunTool,
      createManualRunTool,
      updateManualRunTool,
      listRunTestCasesTool,
      updateRunTestCaseTool,
      // Sessions
      listSessionsTool,
      getSessionTool,
      createSessionTool,
      updateSessionTool,
    ];
  • Endpoint helper function that builds the URL for the debug-testcase API call.
    debugTestCase: (params: {
      projectId: string;
      testcase_name: string;
    }): string => {
      const baseUrl = getBaseUrl();
      const { projectId, testcase_name } = params;
      const queryParams = new URLSearchParams({ testcase_name });
      return `${baseUrl}/api/mcp/${projectId}/debug-testcase?${queryParams.toString()}`;
    },
Behavior4/5

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

Despite no annotations, the description explains the tool is a fetch operation, returns historical data, summary, and a debugging prompt. It implies read-only behavior and no side effects, which is adequate for a debug tool.

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

Conciseness3/5

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

The description is moderately concise at 4 sentences. It contains some meta-instructions about AI analysis, which adds slight verbosity but is still clear.

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

Completeness4/5

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

Given no output schema, the description adequately explains return values (historical data, summary, prompt) and structure. It covers the necessary context for a fetch tool with two parameters.

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 coverage is 100% with clear descriptions for both parameters. The description adds an example usage but does not significantly enhance meaning beyond what the 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?

The description clearly states it fetches historical execution and failure data for a specific test case, using specific verbs and resource. It does not explicitly differentiate from siblings like get_testcase_details, but the purpose is distinct and well-defined.

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

Usage Guidelines4/5

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

The description explicitly says 'Use this when you need to debug a failing test case,' providing clear guidance on when to use. It does not mention when not to use or alternatives, but the context is sufficient given sibling tools.

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/testdino-hq/testdino-mcp'

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