Skip to main content
Glama
ebowwa
by ebowwa

xcode_clean_project

Remove build artifacts from an Xcode project by specifying the project path and scheme, ensuring a clean build environment for iOS/macOS development.

Instructions

Clean build artifacts for an Xcode project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to .xcodeproj file
schemeNoScheme to clean

Implementation Reference

  • Executes the tool logic for 'clean_project' (mapped from 'xcode_clean_project') by building and running the shell command defined in commands.json.
    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 }; } }
  • MCP CallToolRequest handler that maps 'xcode_clean_project' to 'clean_project' and delegates execution to CommandExecutor, formats the response.
    // 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 'xcode_clean_project' based on the 'clean_project' entry 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 dynamic list of tools including 'xcode_clean_project' for ListToolsRequest.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [...tools, ...webMonitorTools], }));
  • Helper function that constructs the actual xcodebuild command for 'clean_project' by replacing placeholders in the command template.
    buildCommand(command: XcodeCommand, args: Record<string, any>): string { let builtCommand = command.command; // Replace required parameters if (command.parameters) { for (const [paramName, paramDef] of Object.entries(command.parameters)) { const value = args[paramName] !== undefined ? args[paramName] : paramDef.default; if (paramDef.type === 'boolean') { // Handle boolean parameters if (value === true) { // Replace placeholder with the template if true builtCommand = builtCommand.replace(`{${paramName}}`, paramDef.template || ''); } else { // Remove placeholder if false builtCommand = builtCommand.replace(`{${paramName}}`, ''); } } else if (value !== undefined && value !== null && value !== '') { if (paramDef.template) { // Use custom template for parameter const paramValue = paramDef.template.replace(`{${paramName}}`, value); builtCommand = builtCommand.replace(`{${paramName}}`, paramValue); } else { // Direct replacement builtCommand = builtCommand.replace(`{${paramName}}`, value); } } else { // Remove optional parameter placeholders builtCommand = builtCommand.replace(new RegExp(`\\s*\\{${paramName}\\}`, 'g'), ''); } } } // Clean up any remaining placeholder patterns builtCommand = builtCommand.replace(/\s+/g, ' ').trim(); return builtCommand; }

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