Skip to main content
Glama

launch_app_sim

Launch an app on an iOS simulator by specifying the simulator UUID and app bundle ID. Requires pre-installed app in the simulator. Use for workflow: build → install → launch.

Instructions

Launches an app in an iOS simulator. IMPORTANT: You MUST provide both the simulatorUuid and bundleId parameters.

Note: You must install the app in the simulator before launching. The typical workflow is: build → install → launch. Example: launch_app_sim({ simulatorUuid: 'YOUR_UUID_HERE', bundleId: 'com.example.MyApp' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoAdditional arguments to pass to the app
bundleIdYesBundle identifier of the app to launch (e.g., 'com.example.MyApp')
simulatorUuidYesUUID of the simulator to use (obtained from list_simulators)

Implementation Reference

  • The core handler logic for the 'launch_app_sim' tool. Validates required parameters (simulatorUuid and bundleId), checks if the app is installed using 'xcrun simctl get_app_container', launches the app using 'xcrun simctl launch' with optional args, handles errors, and returns success response with next steps for log capturing.
    async (params): Promise<ToolResponse> => { const simulatorUuidValidation = validateRequiredParam('simulatorUuid', params.simulatorUuid); if (!simulatorUuidValidation.isValid) { return simulatorUuidValidation.errorResponse!; } const bundleIdValidation = validateRequiredParam('bundleId', params.bundleId); if (!bundleIdValidation.isValid) { return bundleIdValidation.errorResponse!; } log('info', `Starting xcrun simctl launch request for simulator ${params.simulatorUuid}`); // Check if the app is installed in the simulator try { const getAppContainerCmd = [ 'xcrun', 'simctl', 'get_app_container', params.simulatorUuid, params.bundleId, 'app', ]; const getAppContainerResult = await executeCommand( getAppContainerCmd, 'Check App Installed', ); if (!getAppContainerResult.success) { return { content: [ { type: 'text', text: `App is not installed on the simulator. Please use install_app_in_simulator before launching.\n\nWorkflow: build → install → launch.`, }, ], isError: true, }; } } catch { return { content: [ { type: 'text', text: `App is not installed on the simulator (check failed). Please use install_app_in_simulator before launching.\n\nWorkflow: build → install → launch.`, }, ], isError: true, }; } try { const command = ['xcrun', 'simctl', 'launch', params.simulatorUuid, params.bundleId]; if (params.args && params.args.length > 0) { command.push(...params.args); } const result = await executeCommand(command, 'Launch App in Simulator'); if (!result.success) { return { content: [ { type: 'text', text: `Launch app in simulator operation failed: ${result.error}`, }, ], }; } return { content: [ { type: 'text', text: `App launched successfully in simulator ${params.simulatorUuid}`, }, { type: 'text', text: `Next Steps: 1. You can now interact with the app in the simulator. 2. Log capture options: - Option 1: Capture structured logs only (app continues running): start_sim_log_cap({ simulatorUuid: "${params.simulatorUuid}", bundleId: "${params.bundleId}" }) - Option 2: Capture both console and structured logs (app will restart): start_sim_log_cap({ simulatorUuid: "${params.simulatorUuid}", bundleId: "${params.bundleId}", captureConsole: true }) - Option 3: Restart with logs in one step: launch_app_logs_sim({ simulatorUuid: "${params.simulatorUuid}", bundleId: "${params.bundleId}" }) 3. When done with any option, use: stop_sim_log_cap({ logSessionId: 'SESSION_ID' })`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log('error', `Error during launch app in simulator operation: ${errorMessage}`); return { content: [ { type: 'text', text: `Launch app in simulator operation failed: ${errorMessage}`, }, ], }; } },
  • Input schema defined using Zod for the tool parameters: simulatorUuid (required string), bundleId (required string), args (optional array of strings).
    { simulatorUuid: z .string() .describe('UUID of the simulator to use (obtained from list_simulators)'), bundleId: z .string() .describe("Bundle identifier of the app to launch (e.g., 'com.example.MyApp')"), args: z.array(z.string()).optional().describe('Additional arguments to pass to the app'), },
  • The registration function that registers the 'launch_app_sim' tool with the MCP server using server.tool(), including the tool name, description, input schema, and handler function.
    export function registerLaunchAppInSimulatorTool(server: McpServer): void { server.tool( 'launch_app_sim', "Launches an app in an iOS simulator. IMPORTANT: You MUST provide both the simulatorUuid and bundleId parameters.\n\nNote: You must install the app in the simulator before launching. The typical workflow is: build → install → launch. Example: launch_app_sim({ simulatorUuid: 'YOUR_UUID_HERE', bundleId: 'com.example.MyApp' })", { simulatorUuid: z .string() .describe('UUID of the simulator to use (obtained from list_simulators)'), bundleId: z .string() .describe("Bundle identifier of the app to launch (e.g., 'com.example.MyApp')"), args: z.array(z.string()).optional().describe('Additional arguments to pass to the app'), }, async (params): Promise<ToolResponse> => { const simulatorUuidValidation = validateRequiredParam('simulatorUuid', params.simulatorUuid); if (!simulatorUuidValidation.isValid) { return simulatorUuidValidation.errorResponse!; } const bundleIdValidation = validateRequiredParam('bundleId', params.bundleId); if (!bundleIdValidation.isValid) { return bundleIdValidation.errorResponse!; } log('info', `Starting xcrun simctl launch request for simulator ${params.simulatorUuid}`); // Check if the app is installed in the simulator try { const getAppContainerCmd = [ 'xcrun', 'simctl', 'get_app_container', params.simulatorUuid, params.bundleId, 'app', ]; const getAppContainerResult = await executeCommand( getAppContainerCmd, 'Check App Installed', ); if (!getAppContainerResult.success) { return { content: [ { type: 'text', text: `App is not installed on the simulator. Please use install_app_in_simulator before launching.\n\nWorkflow: build → install → launch.`, }, ], isError: true, }; } } catch { return { content: [ { type: 'text', text: `App is not installed on the simulator (check failed). Please use install_app_in_simulator before launching.\n\nWorkflow: build → install → launch.`, }, ], isError: true, }; } try { const command = ['xcrun', 'simctl', 'launch', params.simulatorUuid, params.bundleId]; if (params.args && params.args.length > 0) { command.push(...params.args); } const result = await executeCommand(command, 'Launch App in Simulator'); if (!result.success) { return { content: [ { type: 'text', text: `Launch app in simulator operation failed: ${result.error}`, }, ], }; } return { content: [ { type: 'text', text: `App launched successfully in simulator ${params.simulatorUuid}`, }, { type: 'text', text: `Next Steps: 1. You can now interact with the app in the simulator. 2. Log capture options: - Option 1: Capture structured logs only (app continues running): start_sim_log_cap({ simulatorUuid: "${params.simulatorUuid}", bundleId: "${params.bundleId}" }) - Option 2: Capture both console and structured logs (app will restart): start_sim_log_cap({ simulatorUuid: "${params.simulatorUuid}", bundleId: "${params.bundleId}", captureConsole: true }) - Option 3: Restart with logs in one step: launch_app_logs_sim({ simulatorUuid: "${params.simulatorUuid}", bundleId: "${params.bundleId}" }) 3. When done with any option, use: stop_sim_log_cap({ logSessionId: 'SESSION_ID' })`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); log('error', `Error during launch app in simulator operation: ${errorMessage}`); return { content: [ { type: 'text', text: `Launch app in simulator operation failed: ${errorMessage}`, }, ], }; } }, ); }
  • Top-level tool registration entry in the toolRegistrations array that includes the registerLaunchAppInSimulatorTool function, assigns it to APP_DEPLOYMENT and IOS_SIMULATOR_WORKFLOW groups, and controls enabling via environment variable.
    { register: registerLaunchAppInSimulatorTool, groups: [ToolGroup.APP_DEPLOYMENT, ToolGroup.IOS_SIMULATOR_WORKFLOW], envVar: 'XCODEBUILDMCP_TOOL_LAUNCH_APP_IN_SIMULATOR', },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SampsonKY/XcodeBuildMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server