get_test_report
Retrieve detailed local test reports for specific test runs to analyze results and identify issues in WordPress/WooCommerce plugin testing.
Instructions
Get a detailed local test report for a specific test run. Only available for tests run locally (not managed tests).
⚠️ QIT CLI not detected. QIT CLI not found. Please install it using one of these methods:
Via Composer (recommended): composer require woocommerce/qit-cli --dev
Set QIT_CLI_PATH environment variable: export QIT_CLI_PATH=/path/to/qit
Ensure 'qit' is available in your system PATH
For more information, visit: https://github.com/woocommerce/qit-cli
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| test_run_id | Yes | Test run ID to get report for |
Implementation Reference
- src/tools/test-results.ts:131-157 (handler)Executes the 'qit test report' CLI command for the given test_run_id, handles output including 'not found' cases, and returns formatted content with error flag.handler: async (args: { test_run_id: string }) => { const cmdArgs = ["report", args.test_run_id]; const result = await executeQitCommand(cmdArgs); const output = result.stdout || result.stderr || ""; // Check if it's a "report not found" error vs actual report content if (output.includes("Could not find") || output.includes("not found")) { return { content: `Report not available locally. This may be a managed test (run on GitHub Actions) or the local report files were cleaned up. Use get_test_result to see the test status and result URL.`, isError: false, }; } // If we got output, return it (even with exit code 1 for failed tests) if (output) { return { content: output, isError: false, }; } return { content: "No report found", isError: true, }; },
- src/tools/test-results.ts:128-130 (schema)Zod input schema requiring a single string parameter 'test_run_id'.inputSchema: z.object({ test_run_id: z.string().describe("Test run ID to get report for"), }),
- src/tools/index.ts:10-19 (registration)The get_test_report tool is registered by spreading testResultsTools into the allTools object, which is imported and used by the MCP server.export const allTools = { ...authTools, ...testExecutionTools, ...testResultsTools, ...groupsTools, ...environmentTools, ...packagesTools, ...configTools, ...utilitiesTools, };
- src/server.ts:25-38 (registration)MCP server lists all tools including get_test_report by iterating over allTools.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-75 (registration)MCP server handles calls to get_test_report by looking up the tool in allTools, validating args with its schema, and invoking its handler.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) {