open_sim
Launch the iOS Simulator app directly by enabling the tool, simplifying the process of testing iOS applications on the sl-test MCP server.
Instructions
Opens the iOS Simulator app.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| enabled | Yes |
Implementation Reference
- src/tools/simulator.ts:438-496 (handler)The handler function for the 'open_sim' tool, which launches the iOS Simulator application using the 'open -a Simulator' command and provides next steps guidance.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/tools/simulator.ts:442-443 (schema)Input schema for the 'open_sim' tool using Zod validation.enabled: z.boolean(), },
- src/tools/simulator.ts:437-497 (registration)The registration function that sets up the 'open_sim' tool on the MCP server.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)Configuration object used to conditionally register the open_sim tool via registerIfEnabled.register: registerOpenSimulatorTool, groups: [ToolGroup.SIMULATOR_MANAGEMENT, ToolGroup.IOS_SIMULATOR_WORKFLOW], envVar: 'XCODEBUILDMCP_TOOL_OPEN_SIMULATOR', },