Skip to main content
Glama

xcresult_summary

Extract and summarize test results from Xcode .xcresult files to quickly identify test outcomes and failures.

Instructions

Get a quick summary of test results from an XCResult file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xcresult_pathYesAbsolute path to the .xcresult file

Implementation Reference

  • Core implementation of xcresult_summary tool. Validates input path, uses XCResultParser to analyze the XCResult file, generates formatted summary with test counts, pass rate, duration, top failures, and usage instructions.
    public static async xcresultSummary(xcresultPath: string): 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);
        const analysis = await parser.analyzeXCResult();
    
        let output = `πŸ“Š XCResult Summary - ${xcresultPath}\n`;
        output += '='.repeat(80) + '\n\n';
        output += `Result: ${analysis.summary.result === 'Failed' ? '❌' : 'βœ…'} ${analysis.summary.result}\n`;
        output += `Total: ${analysis.totalTests} | Passed: ${analysis.passedTests} βœ… | Failed: ${analysis.failedTests} ❌ | Skipped: ${analysis.skippedTests} ⏭️\n`;
        output += `Pass Rate: ${analysis.passRate.toFixed(1)}%\n`;
        output += `Duration: ${analysis.duration}\n\n`;
    
        if (analysis.failedTests > 0) {
          output += `❌ Failed Tests:\n`;
          for (const failure of analysis.summary.testFailures.slice(0, 5)) {
            output += `  β€’ ${failure.testName}: ${failure.failureText.substring(0, 100)}${failure.failureText.length > 100 ? '...' : ''}\n`;
          }
          if (analysis.summary.testFailures.length > 5) {
            output += `  ... and ${analysis.summary.testFailures.length - 5} more\n`;
          }
          output += '\n';
        }
    
        output += `πŸ’‘ Use 'xcresult_browse "${xcresultPath}"' to explore detailed results.`;
    
        return { content: [{ type: 'text', text: output }] };
      } 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}`
        );
      }
    }
  • MCP server handler that validates parameters and delegates to XCResultTools.xcresultSummary
    case 'xcresult_summary':
      if (!args.xcresult_path) {
        throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcresult_path`);
      }
      return await XCResultTools.xcresultSummary(args.xcresult_path as string);
  • Tool schema definition used by MCP server listTools handler and CLI
    {
      name: 'xcresult_summary',
      description: 'Get a quick summary of test results from an XCResult file',
      inputSchema: {
        type: 'object',
        properties: {
          xcresult_path: {
            type: 'string',
            description: 'Absolute path to the .xcresult file',
          },
        },
        required: ['xcresult_path'],
      },
    },
  • Fallback tool schema definition for MCP library
      name: 'xcresult_summary',
      description: 'Get a quick summary of test results from an XCResult file',
      inputSchema: {
        type: 'object',
        properties: {
          xcresult_path: {
            type: 'string',
            description: 'Absolute path to the .xcresult file',
          },
        },
        required: ['xcresult_path'],
      },
    },
  • MCP server registration of all tools including xcresult_summary via getToolDefinitions from shared/toolDefinitions.ts (includes the tool schema). Also has duplicate direct handler call logic at lines 978-1010.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      const toolOptions: {
        includeClean: boolean;
        preferredScheme?: string;
        preferredXcodeproj?: string;
      } = { includeClean: this.includeClean };
      
      if (this.preferredScheme) toolOptions.preferredScheme = this.preferredScheme;
      if (this.preferredXcodeproj) toolOptions.preferredXcodeproj = this.preferredXcodeproj;
      
      const toolDefinitions = getToolDefinitions(toolOptions);
      return {
        tools: toolDefinitions.map(tool => ({
          name: tool.name,
          description: tool.description,
          inputSchema: tool.inputSchema
        })),
      };

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