clean_proj
Remove build artifacts for specific Xcode projects using xcodebuild. Requires projectPath; supports optional scheme, configuration, derivedDataPath, and extraArgs for precise cleanup.
Instructions
Cleans build products for a specific project file using xcodebuild. IMPORTANT: Requires projectPath. Scheme/Configuration are optional. Example: clean_proj({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| configuration | No | Optional: Build configuration to clean (Debug, Release, etc.) | |
| derivedDataPath | No | Optional: Path where derived data might be located | |
| extraArgs | No | Additional xcodebuild arguments | |
| projectPath | Yes | Path to the .xcodeproj file (Required) | |
| scheme | No | Optional: The scheme to clean |
Implementation Reference
- src/tools/clean.ts:27-51 (handler)Core handler logic shared by clean tools. Executes xcodebuild clean command with provided project/workspace path, scheme, configuration, and other params.async function _handleCleanLogic(params: { workspacePath?: string; projectPath?: string; scheme?: string; configuration?: string; derivedDataPath?: string; extraArgs?: string[]; }): Promise<ToolResponse> { log('info', 'Starting xcodebuild clean request (internal)'); // For clean operations, we need to provide a default platform and configuration return executeXcodeBuildCommand( { ...params, scheme: params.scheme || '', // Empty string if not provided configuration: params.configuration || 'Debug', // Default to Debug if not provided }, { platform: XcodePlatform.macOS, // Default to macOS, but this doesn't matter much for clean logPrefix: 'Clean', }, false, 'clean', // Specify 'clean' as the build action ); }
- src/tools/clean.ts:81-92 (schema)Zod input schema defining parameters for the clean_proj tool: required projectPath, optional scheme, configuration, derivedDataPath, extraArgs.projectPath: z.string().describe('Path to the .xcodeproj file (Required)'), scheme: z.string().optional().describe('Optional: The scheme to clean'), configuration: z .string() .optional() .describe('Optional: Build configuration to clean (Debug, Release, etc.)'), derivedDataPath: z .string() .optional() .describe('Optional: Path where derived data might be located'), extraArgs: z.array(z.string()).optional().describe('Additional xcodebuild arguments'), },
- src/tools/clean.ts:76-95 (registration)Registers the 'clean_proj' MCP tool on the server with name, description, input schema, and handler function.export function registerCleanProjectTool(server: McpServer): void { server.tool( 'clean_proj', "Cleans build products for a specific project file using xcodebuild. IMPORTANT: Requires projectPath. Scheme/Configuration are optional. Example: clean_proj({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })", { projectPath: z.string().describe('Path to the .xcodeproj file (Required)'), scheme: z.string().optional().describe('Optional: The scheme to clean'), configuration: z .string() .optional() .describe('Optional: Build configuration to clean (Debug, Release, etc.)'), derivedDataPath: z .string() .optional() .describe('Optional: Path where derived data might be located'), extraArgs: z.array(z.string()).optional().describe('Additional xcodebuild arguments'), }, (params) => _handleCleanLogic(params), ); }
- src/utils/register-tools.ts:150-157 (registration)Configures conditional registration of the clean_proj tool via registerCleanProjectTool in the toolRegistrations array, associated with multiple workflows.register: registerCleanProjectTool, groups: [ ToolGroup.MACOS_WORKFLOW, ToolGroup.IOS_SIMULATOR_WORKFLOW, ToolGroup.IOS_DEVICE_WORKFLOW, ], envVar: 'XCODEBUILDMCP_TOOL_CLEAN_PROJECT', },