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, }; } });

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