get_build_settings
Retrieve build settings for a specific scheme in an Xcode project by providing the project path, scheme, configuration, and target platform. Simplify development workflows with precise control over project configurations.
Instructions
Get build settings for a specific scheme in an Xcode project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| configuration | No | Build configuration (Debug/Release) | |
| platform | No | Target platform (iOS, macOS, tvOS, watchOS, visionOS) | |
| projectPath | Yes | Path to the Xcode project or workspace | |
| scheme | Yes | Xcode scheme to get settings for |
Implementation Reference
- Main helper function that executes xcodebuild -showBuildSettings to retrieve build settings for a given Xcode project/workspace, scheme, configuration, and platform.async getBuildSettings( projectPath: string, isWorkspace: boolean, scheme: string, configuration?: string, platform?: Platform ): Promise<any> { const projectFlag = isWorkspace ? '-workspace' : '-project'; let command = `xcodebuild -showBuildSettings ${projectFlag} "${projectPath}"`; command += ` -scheme "${scheme}"`; if (configuration) { command += ` -configuration "${configuration}"`; } if (platform) { // Add a generic destination for the platform to get appropriate settings const { PlatformInfo } = await import('../../features/build/domain/PlatformInfo.js'); const platformInfo = PlatformInfo.fromPlatform(platform); const destination = platformInfo.generateGenericDestination(); command += ` -destination '${destination}'`; } command += ' -json'; logger.debug({ command }, 'Get build settings command'); try { const { stdout } = await execAsync(command, { maxBuffer: 10 * 1024 * 1024 }); const settings = JSON.parse(stdout); logger.debug({ projectPath, scheme }, 'Got build settings'); return settings; } catch (error: any) { logger.error({ error: error.message, projectPath, scheme }, 'Failed to get build settings'); throw new Error(`Failed to get build settings: ${error.message}`); } }
- Convenience wrapper on XcodeProject class that calls the underlying XcodeInfo.getBuildSettings method.async getBuildSettings( scheme: string, configuration?: string, platform?: Platform ): Promise<any> { const isWorkspace = this.type === 'workspace'; return await this.info.getBuildSettings( this.path, isWorkspace, scheme, configuration, platform ); }
- src/index.ts:99-99 (registration)Commented out registration of GetBuildSettingsTool in the main MCP server index file.// new GetBuildSettingsTool(),