build_ios_sim_name_ws
Build an iOS app from a workspace for a specific simulator by name. Requires workspace path, scheme, and simulator name to compile and run iOS applications in designated simulators.
Instructions
Builds an iOS app from a workspace for a specific simulator by name. IMPORTANT: Requires workspacePath, scheme, and simulatorName. Example: build_ios_sim_name_ws({ workspacePath: '/path/to/MyProject.xcworkspace', scheme: 'MyScheme', simulatorName: 'iPhone 16' })
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspacePath | Yes | Path to the .xcworkspace file (Required) | |
| scheme | Yes | The scheme to use (Required) | |
| simulatorName | Yes | Name of the simulator to use (e.g., 'iPhone 16') (Required) | |
| configuration | No | Build configuration (Debug, Release, etc.) | |
| derivedDataPath | No | Path where build products and other derived data will go | |
| extraArgs | No | Additional xcodebuild arguments | |
| useLatestOS | No | Whether to use the latest OS version for the named simulator | |
| preferXcodebuild | No | If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails. |
Implementation Reference
- src/tools/build_ios_simulator.ts:42-70 (handler)Core handler function that executes the iOS simulator build using xcodebuild, called by the tool's registration handler.async function _handleIOSSimulatorBuildLogic(params: { workspacePath?: string; projectPath?: string; scheme: string; configuration: string; simulatorName?: string; simulatorId?: string; useLatestOS: boolean; derivedDataPath?: string; extraArgs?: string[]; preferXcodebuild?: boolean; }): Promise<ToolResponse> { log('info', `Starting iOS Simulator build for scheme ${params.scheme} (internal)`); return executeXcodeBuildCommand( { ...params, }, { platform: XcodePlatform.iOSSimulator, simulatorName: params.simulatorName, simulatorId: params.simulatorId, useLatestOS: params.useLatestOS, logPrefix: 'iOS Simulator Build', }, params.preferXcodebuild, 'build', ); }
- src/tools/build_ios_simulator.ts:358-404 (registration)Registration function that defines and registers the 'build_ios_sim_name_ws' tool with MCP server, including input schema, description, and thin handler wrapper.export function registerIOSSimulatorBuildByNameWorkspaceTool(server: McpServer): void { type Params = { workspacePath: string; scheme: string; simulatorName: string; configuration?: string; derivedDataPath?: string; extraArgs?: string[]; useLatestOS?: boolean; preferXcodebuild?: boolean; }; registerTool<Params>( server, 'build_ios_sim_name_ws', "Builds an iOS app from a workspace for a specific simulator by name. IMPORTANT: Requires workspacePath, scheme, and simulatorName. Example: build_ios_sim_name_ws({ workspacePath: '/path/to/MyProject.xcworkspace', scheme: 'MyScheme', simulatorName: 'iPhone 16' })", { workspacePath: workspacePathSchema, scheme: schemeSchema, simulatorName: simulatorNameSchema, configuration: configurationSchema, derivedDataPath: derivedDataPathSchema, extraArgs: extraArgsSchema, useLatestOS: useLatestOSSchema, preferXcodebuild: preferXcodebuildSchema, }, async (params: Params) => { // Validate required parameters const workspaceValidation = validateRequiredParam('workspacePath', params.workspacePath); if (!workspaceValidation.isValid) return workspaceValidation.errorResponse!; const schemeValidation = validateRequiredParam('scheme', params.scheme); if (!schemeValidation.isValid) return schemeValidation.errorResponse!; const simulatorNameValidation = validateRequiredParam('simulatorName', params.simulatorName); if (!simulatorNameValidation.isValid) return simulatorNameValidation.errorResponse!; // Provide defaults return _handleIOSSimulatorBuildLogic({ ...params, configuration: params.configuration ?? 'Debug', useLatestOS: params.useLatestOS ?? true, preferXcodebuild: params.preferXcodebuild ?? false, }); }, ); }
- src/tools/common.ts:22-62 (schema)Zod schemas for common tool parameters, used in the input schema for 'build_ios_sim_name_ws'.export const workspacePathSchema = z.string().describe('Path to the .xcworkspace file (Required)'); export const projectPathSchema = z.string().describe('Path to the .xcodeproj file (Required)'); export const schemeSchema = z.string().describe('The scheme to use (Required)'); export const configurationSchema = z .string() .optional() .describe('Build configuration (Debug, Release, etc.)'); export const derivedDataPathSchema = z .string() .optional() .describe('Path where build products and other derived data will go'); export const extraArgsSchema = z .array(z.string()) .optional() .describe('Additional xcodebuild arguments'); export const simulatorNameSchema = z .string() .describe("Name of the simulator to use (e.g., 'iPhone 16') (Required)"); export const simulatorIdSchema = z .string() .describe('UUID of the simulator to use (obtained from listSimulators) (Required)'); export const useLatestOSSchema = z .boolean() .optional() .describe('Whether to use the latest OS version for the named simulator'); export const appPathSchema = z .string() .describe('Path to the .app bundle (full path to the .app directory)'); export const bundleIdSchema = z .string() .describe("Bundle identifier of the app (e.g., 'com.example.MyApp')"); export const launchArgsSchema = z .array(z.string()) .optional() .describe('Additional arguments to pass to the app'); export const preferXcodebuildSchema = z .boolean() .optional() .describe( 'If true, prefers xcodebuild over the experimental incremental build system, useful for when incremental build system fails.', );
- src/utils/register-tools.ts:217-220 (registration)Invocation of the tool registration function in the central tool registration array.register: registerIOSSimulatorBuildByNameWorkspaceTool, groups: [ToolGroup.IOS_SIMULATOR_WORKFLOW], envVar: 'XCODEBUILDMCP_TOOL_IOS_SIMULATOR_BUILD_BY_NAME_WORKSPACE', },