show_build_set_proj
Extract build settings from Xcode project files using xcodebuild. Specify project path and scheme to retrieve configuration details.
Instructions
Shows build settings from a project file using xcodebuild. IMPORTANT: Requires projectPath and scheme. Example: show_build_set_proj({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the .xcodeproj file (Required) | |
| scheme | Yes | The scheme to use (Required) |
Implementation Reference
- src/tools/build_settings.ts:34-79 (handler)The primary handler logic that constructs and executes the 'xcodebuild -showBuildSettings' command based on provided projectPath or workspacePath and scheme, then returns formatted output.async function _handleShowBuildSettingsLogic(params: { workspacePath?: string; projectPath?: string; scheme: string; }): Promise<ToolResponse> { log('info', `Showing build settings for scheme ${params.scheme}`); try { // Create the command array for xcodebuild const command = ['xcodebuild', '-showBuildSettings']; // -showBuildSettings as an option, not an action // Add the workspace or project if (params.workspacePath) { command.push('-workspace', params.workspacePath); } else if (params.projectPath) { command.push('-project', params.projectPath); } // Add the scheme command.push('-scheme', params.scheme); // Execute the command directly const result = await executeCommand(command, 'Show Build Settings'); if (!result.success) { return createTextResponse(`Failed to show build settings: ${result.error}`, true); } return { content: [ { type: 'text', text: `✅ Build settings for scheme ${params.scheme}:`, }, { type: 'text', text: result.output || 'Build settings retrieved successfully.', }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log('error', `Error showing build settings: ${errorMessage}`); return createTextResponse(`Error showing build settings: ${errorMessage}`, true); } }
- src/tools/build_settings.ts:183-203 (registration)Registers the 'show_build_set_proj' tool with the MCP server, including name, description, schema, and handler that validates params and delegates to core logic.export function registerShowBuildSettingsProjectTool(server: McpServer): void { registerTool<BaseProjectParams>( server, 'show_build_set_proj', "Shows build settings from a project file using xcodebuild. IMPORTANT: Requires projectPath and scheme. Example: show_build_set_proj({ projectPath: '/path/to/MyProject.xcodeproj', scheme: 'MyScheme' })", { projectPath: projectPathSchema, scheme: schemeSchema, }, async (params: BaseProjectParams) => { // Validate required parameters const projectValidation = validateRequiredParam('projectPath', params.projectPath); if (!projectValidation.isValid) return projectValidation.errorResponse!; const schemeValidation = validateRequiredParam('scheme', params.scheme); if (!schemeValidation.isValid) return schemeValidation.errorResponse!; return _handleShowBuildSettingsLogic(params); }, ); }
- src/utils/register-tools.ts:133-137 (registration)Central tool registry entry that conditionally registers the show_build_set_proj tool based on environment variable.{ register: registerShowBuildSettingsProjectTool, groups: [ToolGroup.PROJECT_DISCOVERY], envVar: 'XCODEBUILDMCP_TOOL_SHOW_BUILD_SETTINGS_PROJECT', },
- src/tools/common.ts:23-24 (schema)Zod schema definitions for the required projectPath and scheme input parameters used by the tool.export const projectPathSchema = z.string().describe('Path to the .xcodeproj file (Required)'); export const schemeSchema = z.string().describe('The scheme to use (Required)');
- src/tools/common.ts:160-179 (helper)Utility function that wraps the tool handler and registers it on the MCP server using server.tool.export function registerTool<T extends object>( server: McpServer, name: string, description: string, schema: Record<string, z.ZodType>, handler: (params: T) => Promise<ToolResponse>, ): void { // Create a wrapper handler that matches the signature expected by server.tool const wrappedHandler = ( args: Record<string, unknown>, _extra: unknown, ): Promise<ToolResponse> => { // Assert the type *before* calling the original handler // This confines the type assertion to one place const typedParams = args as T; return handler(typedParams); }; server.tool(name, description, schema, wrappedHandler); }