Skip to main content
Glama

open_test_result

Opens test results in your browser using a test run ID to view detailed reports from QIT MCP Server testing workflows.

Instructions

Open a test result in the default web browser and return the report URL.

⚠️ 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_idYesTest run ID to open in browser

Implementation Reference

  • The handler function that implements the core logic of the 'open_test_result' tool. It runs the QIT CLI 'open' command, extracts the report URL from the output, and returns a formatted text response.
    handler: async (args: { test_run_id: string }) => {
      const cmdArgs = ["open", args.test_run_id];
      const result = await executeQitCommand(cmdArgs);
    
      // The open command outputs to stderr and may exit with code 1 even on success
      // Extract URL from output (either stdout or stderr)
      const output = result.stdout || result.stderr || "";
      const urlMatch = output.match(/https?:\/\/[^\s]+/);
    
      if (urlMatch) {
        return {
          content: `Report opened in browser.\n\nURL: ${urlMatch[0]}`,
          isError: false,
        };
      }
    
      // If we can't find a URL but there's output, return it
      if (output) {
        return {
          content: output,
          isError: false,
        };
      }
    
      return {
        content: "Report opened in browser.",
        isError: false,
      };
    },
  • Zod schema defining the input parameters for the tool: a required string 'test_run_id'.
    inputSchema: z.object({
      test_run_id: z.string().describe("Test run ID to open in browser"),
    }),
  • Registers the 'open_test_result' tool (contained within testResultsTools) by spreading it into the central allTools object used by the MCP server.
    export const allTools = {
      ...authTools,
      ...testExecutionTools,
      ...testResultsTools,
      ...groupsTools,
      ...environmentTools,
      ...packagesTools,
      ...configTools,
      ...utilitiesTools,
    };
  • src/server.ts:25-38 (registration)
    MCP server handler for listing tools, dynamically generates tool list including 'open_test_result' from allTools with JSON schema conversion.
    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 handler for calling tools, retrieves 'open_test_result' from allTools, validates input with its schema, and invokes 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) {
        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