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
| Name | Required | Description | Default |
|---|---|---|---|
| xcresult_path | Yes | Absolute path to the .xcresult file |
Implementation Reference
- src/tools/XCResultTools.ts:201-265 (handler)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}` ); } }
- src/XcodeServer.ts:546-550 (handler)MCP server handler that validates parameters and delegates to XCResultTools.xcresultSummarycase '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'], }, },
- src/mcp/index.ts:378-390 (schema)Fallback tool schema definition for MCP libraryname: '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'], }, },
- src/XcodeServer.ts:301-318 (registration)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 })), };