Skip to main content
Glama

get_test_result

Retrieve test results for WordPress/WooCommerce plugins using test run IDs. Access security, e2e, and activation test outcomes from the QIT testing framework.

Instructions

Get test result(s) by test run ID.

⚠️ QIT CLI not detected. QIT CLI not found. Please install it using one of these methods:

  1. Via Composer (recommended): composer require woocommerce/qit-cli --dev

  2. Set QIT_CLI_PATH environment variable: export QIT_CLI_PATH=/path/to/qit

  3. Ensure 'qit' is available in your system PATH

For more information, visit: https://github.com/woocommerce/qit-cli

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
test_run_idYesSingle test run ID or array of test run IDs
jsonNoReturn output in JSON format

Implementation Reference

  • The handler function that implements the core logic of the 'get_test_result' tool. Validates input test_run_id(s), constructs and executes the appropriate 'qit test-result get' or 'get-multiple' CLI command, processes the output, and returns formatted content or error.
    handler: async (args: {
      test_run_id: string | string[];
      json?: boolean;
    }) => {
      const ids = Array.isArray(args.test_run_id)
        ? args.test_run_id
        : [args.test_run_id];
    
      // Validate test run IDs - must be numeric and within reasonable bounds
      // PHP_INT_MAX on 64-bit is 9223372036854775807
      const MAX_VALID_ID = BigInt("9223372036854775807");
      for (const id of ids) {
        if (!/^\d+$/.test(id)) {
          return {
            content: `Error: Invalid test run ID "${id}". Test run IDs must be numeric.`,
            isError: true,
          };
        }
        try {
          if (BigInt(id) > MAX_VALID_ID) {
            return {
              content: `Error: Test run ID "${id}" is too large. Maximum valid ID is ${MAX_VALID_ID}.`,
              isError: true,
            };
          }
        } catch {
          return {
            content: `Error: Invalid test run ID "${id}".`,
            isError: true,
          };
        }
      }
    
      const cmdArgs = ids.length === 1
        ? buildArgs("get", [ids[0]], { json: args.json })
        : buildArgs("get-multiple", ids, { json: args.json });
    
      const result = await executeQitCommand(cmdArgs);
    
      // The get command returns exit code 1 when test status is failed/warning,
      // but this is not a command error - we still got valid results
      const output = result.stdout || result.stderr || "";
    
      // Check if we got actual test result data (contains "Test Run Id" or JSON structure)
      if (output && (output.includes("Test Run Id") || output.includes("test_run_id") || output.startsWith("{"))) {
        return {
          content: output,
          isError: false,
        };
      }
    
      // If the output looks like an error (e.g., "Test not found"), report as error
      if (!result.success) {
        return {
          content: `Error: ${output || "Failed to get test result"}`,
          isError: true,
        };
      }
    
      return {
        content: output || "No result found",
        isError: false,
      };
    },
  • Zod schema defining the input parameters for the tool: test_run_id (single string or array of strings) and optional json boolean flag.
    inputSchema: z.object({
      test_run_id: z
        .union([z.string(), z.array(z.string())])
        .describe("Single test run ID or array of test run IDs"),
      json: z
        .boolean()
        .optional()
        .describe("Return output in JSON format"),
    }),
  • src/server.ts:25-38 (registration)
    MCP server request handler for listing tools. Converts allTools (including get_test_result) into the MCP tool list format with name, description, and JSON schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      // Check if QIT CLI is available
      const cliInfo = detectQitCli();
    
      const tools = Object.entries(allTools).map(([_, tool]) => ({
        name: tool.name,
        description: cliInfo
          ? tool.description
          : `${tool.description}\n\n⚠️ QIT CLI not detected. ${getQitCliNotFoundError()}`,
        inputSchema: zodToJsonSchema(tool.inputSchema),
      }));
    
      return { tools };
    });
  • src/server.ts:41-87 (registration)
    MCP server request handler for calling tools. Looks up the tool by name in allTools, validates arguments using the tool's inputSchema, invokes the handler, and formats the response.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      const tool = allTools[name as ToolName];
    
      if (!tool) {
        return {
          content: [
            {
              type: "text",
              text: `Unknown tool: ${name}`,
            },
          ],
          isError: true,
        };
      }
    
      try {
        // Validate input
        const validatedArgs = tool.inputSchema.parse(args);
    
        // Execute tool
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        const result = await (tool.handler as (args: any) => Promise<{ content: string; isError: boolean }>)(validatedArgs);
    
        return {
          content: [
            {
              type: "text",
              text: result.content,
            },
          ],
          isError: result.isError,
        };
      } catch (error) {
        const message = error instanceof Error ? error.message : String(error);
        return {
          content: [
            {
              type: "text",
              text: `Error: ${message}`,
            },
          ],
          isError: true,
        };
      }
    });
Behavior1/5

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

No annotations are provided, so the description must fully disclose behavior. However, it fails to describe any behavioral traits—such as whether this is a read-only operation, what permissions are needed, how results are returned (e.g., format, pagination), or error handling. Instead, it's dominated by irrelevant CLI installation instructions, offering no useful context.

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

Conciseness1/5

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

The description is poorly structured and not front-loaded. The first line is useful, but it's buried under lengthy, irrelevant CLI installation warnings that don't belong in a tool description. This wastes space and distracts from the tool's purpose, making it inefficient and cluttered.

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

Completeness1/5

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

Given no annotations and no output schema, the description is incomplete. It lacks essential details like return values, error conditions, or behavioral context. The CLI installation text is irrelevant to the tool's functionality, failing to provide the necessary information for an agent to use the tool effectively.

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 description coverage is 100%, with clear descriptions for 'test_run_id' (single ID or array) and 'json' (boolean for JSON output). The description adds no parameter semantics beyond this, but the schema adequately covers the parameters, meeting the baseline for high coverage.

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

Purpose3/5

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

The description states the tool 'Get test result(s) by test run ID' which clarifies the verb (get) and resource (test result(s)), but it's vague about what 'test result(s)' entails compared to sibling tools like 'get_test_report' or 'open_test_result'. It doesn't distinguish itself from these alternatives, making the purpose somewhat generic.

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?

There is no guidance on when to use this tool versus alternatives like 'get_test_report' or 'open_test_result'. The description focuses entirely on installation errors for QIT CLI, which is irrelevant to usage decisions. This leaves the agent without context for tool selection.

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/woocommerce/qit-mcp'

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