open_simulator
Launch the iOS Simulator application to start testing your apps.
Instructions
Opens the iOS Simulator application
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:251-278 (handler)Handler function that opens the iOS Simulator application by running 'open -a Simulator.app'. Returns success/error with troubleshooting info.
async () => { try { await run("open", ["-a", "Simulator.app"]); return { isError: false, content: [ { type: "text", text: "Simulator.app opened successfully", }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: errorWithTroubleshooting( `Error opening Simulator.app: ${toError(error).message}` ), }, ], }; } } ); - src/index.ts:250-250 (schema)Input schema/parameters for the open_simulator tool. Contains title, readOnlyHint, and openWorldHint properties.
{ title: "Open Simulator", readOnlyHint: false, openWorldHint: true }, - src/index.ts:246-279 (registration)Registration of the 'open_simulator' tool on the MCP server, guarded by isToolFiltered check.
if (!isToolFiltered("open_simulator")) { server.tool( "open_simulator", "Opens the iOS Simulator application", { title: "Open Simulator", readOnlyHint: false, openWorldHint: true }, async () => { try { await run("open", ["-a", "Simulator.app"]); return { isError: false, content: [ { type: "text", text: "Simulator.app opened successfully", }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: errorWithTroubleshooting( `Error opening Simulator.app: ${toError(error).message}` ), }, ], }; } } ); } - src/index.ts:77-93 (helper)Helper used by the handler to execute shell commands (specifically 'open -a Simulator.app').
async function run( cmd: string, args: string[], options: RunOptions = {} ): Promise<{ stdout: string; stderr: string }> { const mergedEnv = options.env ? { ...process.env, ...options.env } : process.env; const { stdout, stderr } = await execFileAsync(cmd, args, { shell: false, env: mergedEnv, }); return { stdout: stdout.trim(), stderr: stderr.trim(), }; } - src/index.ts:166-168 (helper)Helper used to format error messages with a troubleshooting guide link.
function errorWithTroubleshooting(message: string): string { return `${message}\n\nFor help, see the ${troubleshootingLink()}`; }