Skip to main content
Glama

install_app_sim

Install iOS applications into specific simulators by providing the simulator UUID and app bundle path for testing and development purposes.

Instructions

Installs an app in an iOS simulator. IMPORTANT: You MUST provide both the simulatorUuid and appPath parameters. Example: install_app_sim({ simulatorUuid: 'YOUR_UUID_HERE', appPath: '/path/to/your/app.app' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
simulatorUuidYesUUID of the simulator to use (obtained from list_simulators)
appPathYesPath to the .app bundle to install (full path to the .app directory)

Implementation Reference

  • Executes the tool logic: validates simulatorUuid and appPath, checks if app file exists, runs 'xcrun simctl install', extracts bundle ID if possible, and returns success message with next steps.
        async (params): Promise<ToolResponse> => {
          const simulatorUuidValidation = validateRequiredParam('simulatorUuid', params.simulatorUuid);
          if (!simulatorUuidValidation.isValid) {
            return simulatorUuidValidation.errorResponse!;
          }
    
          const appPathValidation = validateRequiredParam('appPath', params.appPath);
          if (!appPathValidation.isValid) {
            return appPathValidation.errorResponse!;
          }
    
          const appPathExistsValidation = validateFileExists(params.appPath);
          if (!appPathExistsValidation.isValid) {
            return appPathExistsValidation.errorResponse!;
          }
    
          log('info', `Starting xcrun simctl install request for simulator ${params.simulatorUuid}`);
    
          try {
            const command = ['xcrun', 'simctl', 'install', params.simulatorUuid, params.appPath];
            const result = await executeCommand(command, 'Install App in Simulator');
    
            if (!result.success) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Install app in simulator operation failed: ${result.error}`,
                  },
                ],
              };
            }
    
            let bundleId = '';
            try {
              bundleId = execSync(`defaults read "${params.appPath}/Info" CFBundleIdentifier`)
                .toString()
                .trim();
            } catch (error) {
              log('warning', `Could not extract bundle ID from app: ${error}`);
            }
    
            return {
              content: [
                {
                  type: 'text',
                  text: `App installed successfully in simulator ${params.simulatorUuid}`,
                },
                {
                  type: 'text',
                  text: `Next Steps:
    1. Open the Simulator app: open_sim({ enabled: true })
    2. Launch the app: launch_app_sim({ simulatorUuid: "${params.simulatorUuid}"${bundleId ? `, bundleId: "${bundleId}"` : ', bundleId: "YOUR_APP_BUNDLE_ID"'} })`,
                },
              ],
            };
          } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            log('error', `Error during install app in simulator operation: ${errorMessage}`);
            return {
              content: [
                {
                  type: 'text',
                  text: `Install app in simulator operation failed: ${errorMessage}`,
                },
              ],
            };
          }
        },
  • Input schema using Zod: requires simulatorUuid (string) and appPath (string).
    {
      simulatorUuid: z
        .string()
        .describe('UUID of the simulator to use (obtained from list_simulators)'),
      appPath: z
        .string()
        .describe('Path to the .app bundle to install (full path to the .app directory)'),
    },
  • Registers the 'install_app_sim' tool on the MCP server with name, description, input schema, and handler function.
      server.tool(
        'install_app_sim',
        "Installs an app in an iOS simulator. IMPORTANT: You MUST provide both the simulatorUuid and appPath parameters. Example: install_app_sim({ simulatorUuid: 'YOUR_UUID_HERE', appPath: '/path/to/your/app.app' })",
        {
          simulatorUuid: z
            .string()
            .describe('UUID of the simulator to use (obtained from list_simulators)'),
          appPath: z
            .string()
            .describe('Path to the .app bundle to install (full path to the .app directory)'),
        },
        async (params): Promise<ToolResponse> => {
          const simulatorUuidValidation = validateRequiredParam('simulatorUuid', params.simulatorUuid);
          if (!simulatorUuidValidation.isValid) {
            return simulatorUuidValidation.errorResponse!;
          }
    
          const appPathValidation = validateRequiredParam('appPath', params.appPath);
          if (!appPathValidation.isValid) {
            return appPathValidation.errorResponse!;
          }
    
          const appPathExistsValidation = validateFileExists(params.appPath);
          if (!appPathExistsValidation.isValid) {
            return appPathExistsValidation.errorResponse!;
          }
    
          log('info', `Starting xcrun simctl install request for simulator ${params.simulatorUuid}`);
    
          try {
            const command = ['xcrun', 'simctl', 'install', params.simulatorUuid, params.appPath];
            const result = await executeCommand(command, 'Install App in Simulator');
    
            if (!result.success) {
              return {
                content: [
                  {
                    type: 'text',
                    text: `Install app in simulator operation failed: ${result.error}`,
                  },
                ],
              };
            }
    
            let bundleId = '';
            try {
              bundleId = execSync(`defaults read "${params.appPath}/Info" CFBundleIdentifier`)
                .toString()
                .trim();
            } catch (error) {
              log('warning', `Could not extract bundle ID from app: ${error}`);
            }
    
            return {
              content: [
                {
                  type: 'text',
                  text: `App installed successfully in simulator ${params.simulatorUuid}`,
                },
                {
                  type: 'text',
                  text: `Next Steps:
    1. Open the Simulator app: open_sim({ enabled: true })
    2. Launch the app: launch_app_sim({ simulatorUuid: "${params.simulatorUuid}"${bundleId ? `, bundleId: "${bundleId}"` : ', bundleId: "YOUR_APP_BUNDLE_ID"'} })`,
                },
              ],
            };
          } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            log('error', `Error during install app in simulator operation: ${errorMessage}`);
            return {
              content: [
                {
                  type: 'text',
                  text: `Install app in simulator operation failed: ${errorMessage}`,
                },
              ],
            };
          }
        },
      );
    }
  • Includes the registerInstallAppInSimulatorTool in the toolRegistrations array, which is used to conditionally register tools based on environment variables.
    register: registerInstallAppInSimulatorTool,
    groups: [ToolGroup.APP_DEPLOYMENT, ToolGroup.IOS_SIMULATOR_WORKFLOW],

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