Skip to main content
Glama

launch_app_sim

Launch iOS apps in simulators by providing simulator UUID and bundle identifier for testing and development workflows.

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
simulatorUuidYesUUID of the simulator to use (obtained from list_simulators)
bundleIdYesBundle identifier of the app to launch (e.g., 'com.example.MyApp')
argsNoAdditional arguments to pass to the app

Implementation Reference

  • The core handler function for the 'launch_app_sim' tool. It validates inputs, checks if the app is installed using 'xcrun simctl get_app_container', launches the app with 'xcrun simctl launch', handles success/error responses, and suggests 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}`,
                },
              ],
            };
          }
        },
  • Zod schema defining the input parameters for the 'launch_app_sim' tool: required simulatorUuid and bundleId, optional args array.
    {
      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 defines and registers the 'launch_app_sim' tool on the MCP server using server.tool(), including name, description, schema, and handler.
    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}`,
                },
              ],
            };
          }
        },
      );
    }
  • Entry in the toolRegistrations array that includes the registerLaunchAppInSimulatorTool function, which is invoked by registerTools() to conditionally register the tool based on environment variables and tool groups.
    {
      register: registerLaunchAppInSimulatorTool,
      groups: [ToolGroup.APP_DEPLOYMENT, ToolGroup.IOS_SIMULATOR_WORKFLOW],
      envVar: 'XCODEBUILDMCP_TOOL_LAUNCH_APP_IN_SIMULATOR',
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates that this is a launch operation (implying execution/mutation), specifies a critical prerequisite (app must be installed), and provides a typical workflow. However, it doesn't mention potential side effects like app state changes or error conditions, leaving some behavioral aspects uncovered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and appropriately sized: it starts with the core purpose, highlights critical requirements, adds workflow context, and provides an example. Every sentence serves a clear purpose, though the example could be slightly more concise. There's no redundant information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description does a good job covering essential context: purpose, prerequisites, workflow, and parameter emphasis. It adequately compensates for the lack of structured behavioral annotations, though it doesn't describe return values or error behaviors, which would be helpful given the absence of an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description emphasizes that both simulatorUuid and bundleId are mandatory ('MUST provide both'), which reinforces the schema's required fields, but adds minimal additional semantic context beyond what the schema provides. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Launches an app') and target resource ('in an iOS simulator'), distinguishing it from sibling tools like launch_app_device (for physical devices) or launch_mac_app (for macOS). It precisely defines the tool's scope without ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: it specifies prerequisites ('You must install the app in the simulator before launching'), outlines the typical workflow ('build → install → launch'), and implicitly distinguishes it from alternatives by focusing on iOS simulators (unlike launch_app_device for devices).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.