Skip to main content
Glama

open_sim

Launch the iOS Simulator app to test mobile applications on virtual devices.

Instructions

Opens the iOS Simulator app.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enabledYes

Implementation Reference

  • 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}`,
                },
              ],
            };
          }
        },
  • Input schema for the open_sim tool, defining an optional 'enabled' boolean parameter.
      enabled: z.boolean(),
    },
  • 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}`,
                },
              ],
            };
          }
        },
      );
    }
  • 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',
    },

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