Skip to main content
Glama
ebowwa
by ebowwa

xcode_test_project

Execute tests for an Xcode project by specifying the project path, test scheme, and destination. Ideal for automating iOS/macOS project testing within the Xcode MCP Server environment.

Instructions

Run tests for an Xcode project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destinationNoTest destination
project_pathYesPath to .xcodeproj file
schemeYesTest scheme name

Implementation Reference

  • MCP CallTool handler for 'xcode_test_project': strips 'xcode_' prefix to get 'test_project', executes via CommandExecutor, formats result as text content
    // Handle Xcode commands // Remove 'xcode_' prefix if present const commandName = name.startsWith('xcode_') ? name.slice(6) : name; const result = await this.commandExecutor.executeCommand(commandName, args); let responseText = result.output; if (result.error) { responseText += `\n\nWarnings/Errors:\n${result.error}`; } if (!result.success) { responseText = `Command failed: ${result.error}\n\nCommand executed: ${result.command}`; } return { content: [ { type: 'text', text: responseText, }, ], };
  • Generates the inputSchema and tool definition for MCP tool 'xcode_test_project' from the 'test_project' command definition in commands.json
    generateMCPToolDefinitions(): Array<{ name: string; description: string; inputSchema: any; }> { return Object.entries(this.commands).map(([name, command]) => ({ name: `xcode_${name}`, description: command.description, inputSchema: { type: 'object', properties: command.parameters ? Object.fromEntries( Object.entries(command.parameters).map(([paramName, paramDef]) => [ paramName, { type: paramDef.type, description: paramDef.description, ...(paramDef.default !== undefined && { default: paramDef.default }) } ]) ) : {}, required: command.parameters ? Object.entries(command.parameters) .filter(([_, paramDef]) => paramDef.required) .map(([paramName]) => paramName) : [] } })); }
  • src/index.ts:87-89 (registration)
    Registers the list of available tools including dynamically generated xcode_* tools from CommandExecutor
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...tools, ...webMonitorTools], }));
  • Core execution logic for 'test_project' command: validates params, builds shell command from template, executes via child_process.execAsync
    async executeCommand(name: string, args: Record<string, any> = {}): Promise<{ success: boolean; output: string; error?: string; command: string; }> { const command = this.getCommand(name); if (!command) { throw new Error(`Command '${name}' not found`); } this.validateParameters(command, args); // Handle internal commands if (command.command.startsWith('internal:')) { return await this.executeInternalCommand(command, args); } // Handle external commands const builtCommand = this.buildCommand(command, args); try { const { stdout, stderr } = await execAsync(builtCommand); return { success: true, output: stdout, error: stderr || undefined, command: builtCommand }; } catch (error) { return { success: false, output: '', error: error instanceof Error ? error.message : String(error), command: builtCommand }; } }
  • Loads command definitions including 'test_project' from commands.json (located at ../commands.json)
    async loadCommands(): Promise<void> { try { const content = await fs.readFile(this.commandsPath, 'utf-8'); const definitions: CommandDefinitions = JSON.parse(content); this.commands = definitions.xcode_commands; } catch (error) { throw new Error(`Failed to load commands from ${this.commandsPath}: ${error}`); } }

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/ebowwa/xcode-mcp'

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