Skip to main content
Glama

xcresult_browse

Browse Xcode test results from .xcresult files to view test outcomes, failure details, and console output for debugging purposes.

Instructions

Browse XCResult files - list all tests or show details for a specific test. Returns comprehensive test results including pass/fail status, failure details, and browsing instructions. Large console output (>20 lines or >2KB) is automatically saved to a temporary file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xcresult_pathYesAbsolute path to the .xcresult file
test_idNoOptional test ID or index number to show details for a specific test
include_consoleNoWhether to include console output and test activities (only used with test_id)

Implementation Reference

  • The core handler function implementing xcresult_browse tool. Validates input, uses XCResultParser to list tests or show specific test details with optional console output.
    public static async xcresultBrowse(
      xcresultPath: string,
      testId?: string,
      includeConsole: boolean = false
    ): Promise<McpResult> {
      // Validate xcresult path
      if (!existsSync(xcresultPath)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `XCResult file not found: ${xcresultPath}`
        );
      }
    
      if (!xcresultPath.endsWith('.xcresult')) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Path must be an .xcresult file: ${xcresultPath}`
        );
      }
    
      // Check if xcresult is readable
      if (!XCResultParser.isXCResultReadable(xcresultPath)) {
        throw new McpError(
          ErrorCode.InternalError,
          `XCResult file is not readable or incomplete: ${xcresultPath}`
        );
      }
    
      try {
        const parser = new XCResultParser(xcresultPath);
    
        if (testId) {
          // Show specific test details
          const details = await parser.formatTestDetails(testId, includeConsole);
          return { content: [{ type: 'text', text: details }] };
        } else {
          // List all tests
          const testList = await parser.formatTestList();
          
          let usage = '\n\nšŸ’” Usage:\n';
          usage += '  View test details: xcresult-browse --xcresult-path <path> --test-id <test-id-or-index>\n';
          usage += '  View with console: xcresult-browse --xcresult-path <path> --test-id <test-id-or-index> --include-console\n';
          usage += '  Get console only: xcresult-browser-get-console --xcresult-path <path> --test-id <test-id-or-index>\n';
          usage += '  Get UI hierarchy: xcresult-get-ui-hierarchy --xcresult-path <path> --test-id <test-id-or-index> --timestamp [timestamp]\n';
          usage += '  Get screenshot: xcresult-get-screenshot --xcresult-path <path> --test-id <test-id-or-index> --timestamp <timestamp>\n';
          usage += '  Examples:\n';
          usage += `    xcresult-browse --xcresult-path "${xcresultPath}" --test-id 5\n`;
          usage += `    xcresult-browse --xcresult-path "${xcresultPath}" --test-id "SomeTest/testMethod()" --include-console\n`;
          usage += `    xcresult-get-ui-hierarchy --xcresult-path "${xcresultPath}" --test-id 5 --timestamp 120.5\n`;
          usage += `    xcresult-get-screenshot --xcresult-path "${xcresultPath}" --test-id 5 --timestamp 120.5\n`;
          
          return { content: [{ type: 'text', text: testList + usage }] };
        }
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        
        if (errorMessage.includes('xcresulttool')) {
          throw new McpError(
            ErrorCode.InternalError,
            `XCResult parsing failed. Make sure Xcode Command Line Tools are installed: ${errorMessage}`
          );
        }
        
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to analyze XCResult: ${errorMessage}`
        );
      }
    }
  • Input schema and metadata definition for the xcresult_browse tool, specifying required xcresult_path and optional test_id and include_console parameters.
    name: 'xcresult_browse',
    description: 'Browse XCResult files - list all tests or show details for a specific test. Returns comprehensive test results including pass/fail status, failure details, and browsing instructions. Large console output (>20 lines or >2KB) is automatically saved to a temporary file.',
    inputSchema: {
      type: 'object',
      properties: {
        xcresult_path: {
          type: 'string',
          description: 'Absolute path to the .xcresult file',
        },
        test_id: {
          type: 'string',
          description: 'Optional test ID or index number to show details for a specific test',
        },
        include_console: {
          type: 'boolean',
          description: 'Whether to include console output and test activities (only used with test_id)',
          default: false,
        },
      },
      required: ['xcresult_path'],
    },
  • Tool registration and dispatch logic in the MCP server CallToolRequest handler. Maps 'xcresult_browse' to XCResultTools.xcresultBrowse call.
    case 'xcresult_browse':
      if (!args.xcresult_path) {
        throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcresult_path`);
      }
      return await XCResultTools.xcresultBrowse(
        args.xcresult_path as string,
        args.test_id as string | undefined,
        args.include_console as boolean || false
      );
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it returns 'comprehensive test results including pass/fail status, failure details, and browsing instructions,' and handles large outputs by automatically saving them to a temporary file. This covers output content and performance considerations, though it doesn't mention error handling or mutation effects (likely read-only).

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, starting with the core purpose. Both sentences add value: the first explains functionality, and the second covers output handling. There's no wasted text, though it could be slightly more structured (e.g., separating usage modes).

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 annotations, no output schema, and 3 parameters with full schema coverage, the description is reasonably complete. It explains what the tool does, output content, and large-output handling. However, it doesn't detail return formats or error cases, which could be useful for a tool with no output schema, leaving minor gaps.

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%, so the schema already documents all parameters thoroughly. The description adds minimal parameter semantics beyond the schema, only noting that 'include_console' is 'only used with test_id.' This aligns with the baseline score of 3 when schema coverage is high, as the description doesn't significantly enhance parameter understanding.

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 the tool's purpose: 'Browse XCResult files - list all tests or show details for a specific test.' It specifies the verb ('browse') and resource ('XCResult files'), and distinguishes between listing tests and showing details. However, it doesn't explicitly differentiate from sibling tools like 'xcresult_summary' or 'xcresult_browser_get_console', which slightly reduces clarity.

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

Usage Guidelines3/5

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

The description implies usage through the phrase 'list all tests or show details for a specific test,' suggesting when to use each mode. It also mentions that 'include_console' is 'only used with test_id,' providing some parameter-specific guidance. However, it lacks explicit when-to-use vs. alternatives (e.g., compared to 'xcresult_summary' or 'xcresult_browser_get_console'), and no exclusions or prerequisites are stated.

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/lapfelix/XcodeMCP'

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