Skip to main content
Glama

find_xcresults

Locate XCResult files for an Xcode project to access test results and build data with timestamps and file details.

Instructions

Find all XCResult files for a specific project with timestamps and file information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xcodeprojYesAbsolute path to the .xcodeproj file (or .xcworkspace if available) - e.g., /path/to/project.xcodeproj

Implementation Reference

  • Main handler implementation for the 'find_xcresults' tool. Validates project path, finds XCResult files using helper, formats and returns list with timestamps and sizes.
    public static async findXCResults(projectPath: string): Promise<McpResult> {
      const validationError = PathValidator.validateProjectPath(projectPath);
      if (validationError) return validationError;
    
      try {
        const xcresultFiles = await this._findXCResultFiles(projectPath);
        
        if (xcresultFiles.length === 0) {
          return { 
            content: [{ 
              type: 'text', 
              text: `No XCResult files found for project: ${projectPath}\n\nXCResult files are created when you run tests. Try running tests first with 'xcode_test'.`
            }] 
          };
        }
    
        let message = `🔍 Found ${xcresultFiles.length} XCResult file(s) for project: ${projectPath}\n\n`;
        message += `📁 XCResult Files (sorted by newest first):\n`;
        message += '='.repeat(80) + '\n';
    
        xcresultFiles.forEach((file, index) => {
          const date = new Date(file.mtime);
          const timeAgo = this._getTimeAgo(file.mtime);
          
          message += `${index + 1}. ${file.path}\n`;
          message += `   📅 Created: ${date.toLocaleString()} (${timeAgo})\n`;
          message += `   📊 Size: ${this._formatFileSize(file.size || 0)}\n\n`;
        });
    
        message += `💡 Usage:\n`;
        message += `  • View results: xcresult-browse --xcresult-path "<path>"\n`;
        message += `  • Get console: xcresult-browser-get-console --xcresult-path "<path>" --test-id <test-id>\n`;
        
        return { content: [{ type: 'text', text: message }] };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        return { 
          content: [{ 
            type: 'text', 
            text: `Failed to find XCResult files: ${errorMessage}` 
          }] 
        };
      }
    }
  • Core helper method that searches DerivedData/Logs/Test for .xcresult bundles, collects paths with metadata, sorts by newest first.
    private static async _findXCResultFiles(projectPath: string): Promise<{ path: string; mtime: number; size?: number }[]> {
      const xcresultFiles: { path: string; mtime: number; size?: number }[] = [];
      
      try {
        // Use existing BuildLogParser logic to find the correct DerivedData directory
        const derivedData = await BuildLogParser.findProjectDerivedData(projectPath);
        
        if (derivedData) {
          // Look for xcresult files in the Test logs directory
          const testLogsDir = join(derivedData, 'Logs', 'Test');
          try {
            const files = await readdir(testLogsDir);
            const xcresultDirs = files.filter(file => file.endsWith('.xcresult'));
            
            for (const xcresultDir of xcresultDirs) {
              const fullPath = join(testLogsDir, xcresultDir);
              try {
                const stats = await stat(fullPath);
                xcresultFiles.push({
                  path: fullPath,
                  mtime: stats.mtime.getTime(),
                  size: stats.size
                });
              } catch {
                // Ignore files we can't stat
              }
            }
          } catch (error) {
            Logger.debug(`Could not read test logs directory: ${error}`);
          }
        }
      } catch (error) {
        Logger.warn(`Error finding xcresult files: ${error}`);
      }
      
      return xcresultFiles.sort((a, b) => b.mtime - a.mtime);
    }
  • Tool schema definition including input schema for xcodeproj parameter.
      name: 'find_xcresults',
      description: 'Find all XCResult files for a specific project with timestamps and file information',
      inputSchema: {
        type: 'object',
        properties: {
          xcodeproj: {
            type: 'string',
            description: preferredXcodeproj 
              ? `Absolute path to the .xcodeproj file (or .xcworkspace if available) - defaults to ${preferredXcodeproj}`
              : 'Absolute path to the .xcodeproj file (or .xcworkspace if available) - e.g., /path/to/project.xcodeproj',
          },
        },
        required: preferredXcodeproj ? [] : ['xcodeproj'],
      },
    },
  • Tool dispatch/registration in MCP server switch statement - calls BuildTools.findXCResults
    case 'find_xcresults':
      if (!args.xcodeproj) {
        throw new McpError(ErrorCode.InvalidParams, `Missing required parameter: xcodeproj`);
      }
      return await BuildTools.findXCResults(args.xcodeproj as string);
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions returning 'timestamps and file information' but doesn't disclose behavioral traits such as whether this is a read-only operation, potential errors, performance considerations, or how results are formatted. The description is minimal and lacks critical operational context.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. Every word contributes directly to understanding the tool's function, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/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 a single parameter with full schema coverage, the description is incomplete. It fails to explain what 'timestamps and file information' entails, how results are returned, or any behavioral aspects, leaving significant gaps for an AI agent to understand tool invocation and outcomes.

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?

The input schema has 100% description coverage, with the single parameter 'xcodeproj' well-documented in the schema. The description adds no additional meaning beyond what the schema provides, such as examples of valid paths or constraints, so it meets the baseline for high schema coverage.

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 action ('find all XCResult files') and resource ('for a specific project'), specifying what the tool does. It distinguishes from siblings like 'xcresult_browse' or 'xcresult_list_attachments' by focusing on file discovery with metadata, but doesn't explicitly differentiate from all siblings.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'xcresult_browse' or 'xcode_test', nor does it mention prerequisites or exclusions. It implies usage for locating XCResult files but lacks explicit context for selection among sibling tools.

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