open_sim
Launch the iOS Simulator app to test mobile applications on virtual devices.
Instructions
Opens the iOS Simulator app.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enabled | Yes |
Implementation Reference
- src/tools/simulator.ts:444-495 (handler)The handler function that executes the 'open -a Simulator' command to open the iOS Simulator app, handles success/error responses, and provides next steps.async (): Promise<ToolResponse> => { log('info', 'Starting open simulator request'); try { const command = ['open', '-a', 'Simulator']; const result = await executeCommand(command, 'Open Simulator'); if (!result.success) { return { content: [ { type: 'text', text: `Open simulator operation failed: ${result.error}`, }, ], }; } return { content: [ { type: 'text', text: `Simulator app opened successfully`, }, { type: 'text', text: `Next Steps: 1. Boot a simulator if needed: boot_sim({ simulatorUuid: 'UUID_FROM_LIST_SIMULATORS' }) 2. Launch your app and interact with it 3. Log capture options: - Option 1: Capture structured logs only (app continues running): start_sim_log_cap({ simulatorUuid: 'UUID', bundleId: 'YOUR_APP_BUNDLE_ID' }) - Option 2: Capture both console and structured logs (app will restart): start_sim_log_cap({ simulatorUuid: 'UUID', bundleId: 'YOUR_APP_BUNDLE_ID', captureConsole: true }) - Option 3: Launch app with logs in one step: launch_app_logs_sim({ simulatorUuid: 'UUID', bundleId: 'YOUR_APP_BUNDLE_ID' })`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log('error', `Error during open simulator operation: ${errorMessage}`); return { content: [ { type: 'text', text: `Open simulator operation failed: ${errorMessage}`, }, ], }; } },
- src/tools/simulator.ts:442-443 (schema)Input schema for the open_sim tool, defining an optional 'enabled' boolean parameter.enabled: z.boolean(), },
- src/tools/simulator.ts:437-497 (registration)The registration function that defines and registers the 'open_sim' tool on the MCP server, including name, description, schema, and handler.export function registerOpenSimulatorTool(server: McpServer): void { server.tool( 'open_sim', 'Opens the iOS Simulator app.', { enabled: z.boolean(), }, async (): Promise<ToolResponse> => { log('info', 'Starting open simulator request'); try { const command = ['open', '-a', 'Simulator']; const result = await executeCommand(command, 'Open Simulator'); if (!result.success) { return { content: [ { type: 'text', text: `Open simulator operation failed: ${result.error}`, }, ], }; } return { content: [ { type: 'text', text: `Simulator app opened successfully`, }, { type: 'text', text: `Next Steps: 1. Boot a simulator if needed: boot_sim({ simulatorUuid: 'UUID_FROM_LIST_SIMULATORS' }) 2. Launch your app and interact with it 3. Log capture options: - Option 1: Capture structured logs only (app continues running): start_sim_log_cap({ simulatorUuid: 'UUID', bundleId: 'YOUR_APP_BUNDLE_ID' }) - Option 2: Capture both console and structured logs (app will restart): start_sim_log_cap({ simulatorUuid: 'UUID', bundleId: 'YOUR_APP_BUNDLE_ID', captureConsole: true }) - Option 3: Launch app with logs in one step: launch_app_logs_sim({ simulatorUuid: 'UUID', bundleId: 'YOUR_APP_BUNDLE_ID' })`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log('error', `Error during open simulator operation: ${errorMessage}`); return { content: [ { type: 'text', text: `Open simulator operation failed: ${errorMessage}`, }, ], }; } }, ); }
- src/utils/register-tools.ts:329-332 (registration)Top-level conditional registration entry for the open_sim tool in the tools registry, controlled by environment variable.register: registerOpenSimulatorTool, groups: [ToolGroup.SIMULATOR_MANAGEMENT, ToolGroup.IOS_SIMULATOR_WORKFLOW], envVar: 'XCODEBUILDMCP_TOOL_OPEN_SIMULATOR', },