Skip to main content
Glama

install_app

Install an app bundle on an iOS simulator to test and run applications during development. Specify the app path and optionally target a specific simulator device.

Instructions

Install an app on the simulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appPathYesPath to the .app bundle
simulatorIdNoDevice UDID or name of the simulator (optional, uses booted device if not specified)

Implementation Reference

  • The execute method implements the core logic of the 'install_app' MCP tool: validates input, creates domain request, executes the use case, and returns formatted success/error response.
    async execute(args: unknown): Promise<{ content: Array<{ type: string; text: string }> }> {
      try {
        // Type guard for input
        if (!args || typeof args !== 'object') {
          throw new Error('Invalid input: expected an object');
        }
    
        const input = args as InstallAppArgs;
    
        // Create domain request (validation happens here)
        const request = InstallRequest.create(input.appPath, input.simulatorId);
    
        // Execute use case
        const result = await this.useCase.execute(request);
    
        // Format response
        return {
          content: [{
            type: 'text',
            text: this.formatResult(result)
          }]
        };
      } catch (error: any) {
        // Handle validation and use case errors consistently
        const message = ErrorFormatter.format(error);
        return {
          content: [{
            type: 'text',
            text: `❌ ${message}`
          }]
        };
      }
    }
  • Defines the input JSON schema for the 'install_app' tool: requires appPath string, optional simulatorId.
    get inputSchema() {
      return {
        type: 'object' as const,
        properties: {
          appPath: {
            type: 'string',
            description: 'Path to the .app bundle'
          },
          simulatorId: {
            type: 'string',
            description: 'Device UDID or name of the simulator (optional, uses booted device if not specified)'
          }
        },
        required: ['appPath']
      };
    }
  • src/index.ts:77-117 (registration)
    Registers the InstallAppController (created via factory) to the MCP server's tools Map by name for handling tool calls.
    private registerTools() {
      // Create instances of all tools
      const toolInstances = [
        // Simulator management
        ListSimulatorsControllerFactory.create(),
        BootSimulatorControllerFactory.create(),
        ShutdownSimulatorControllerFactory.create(),
        // new ViewSimulatorScreenTool(),
        // Build and test
        // new BuildSwiftPackageTool(),
        // new RunSwiftPackageTool(),
        BuildXcodeControllerFactory.create(),
        InstallAppControllerFactory.create(),
        // new RunXcodeTool(),
        // new TestXcodeTool(),
        // new TestSwiftPackageTool(),
        // new CleanBuildTool(),
        // Archive and export
        // new ArchiveProjectTool(),
        // new ExportIPATool(),
        // Project info and schemes
        // new ListSchemesTool(),
        // new GetBuildSettingsTool(),
        // new GetProjectInfoTool(),
        // new ListTargetsTool(),
        // App management
        // new InstallAppTool(),
        // new UninstallAppTool(),
        // Device logs
        // new GetDeviceLogsTool(),
        // Advanced project management
        // new ManageDependenciesTool()
      ];
    
      // Register each tool by its name
      for (const tool of toolInstances) {
        const definition = tool.getToolDefinition();
        this.tools.set(definition.name, tool);
      }
    
      logger.info({ toolCount: this.tools.size }, 'Tools registered');
  • Core business logic for app installation: locates/boots simulator if needed, installs app via ports, handles all errors and logging.
    async execute(request: InstallRequest): Promise<InstallResult> {
      // Get app name from the AppPath value object
      const appName = request.appPath.name;
    
      // Find target simulator
      const simulator = request.simulatorId
        ? await this.simulatorLocator.findSimulator(request.simulatorId.toString())
        : await this.simulatorLocator.findBootedSimulator();
      
      if (!simulator) {
        this.logManager.saveDebugData('install-app-failed', {
          reason: 'simulator_not_found',
          requestedId: request.simulatorId?.toString()
        }, appName);
    
        const error = request.simulatorId
          ? new SimulatorNotFoundError(request.simulatorId)
          : new NoBootedSimulatorError();
        return InstallResult.failed(error, request.appPath, request.simulatorId);
      }
      
      // Boot simulator if needed (only when specific ID provided)
      if (request.simulatorId) {
        if (simulator.state === SimulatorState.Shutdown) {
          try {
            await this.simulatorControl.boot(simulator.id);
            this.logManager.saveDebugData('simulator-auto-booted', {
              simulatorId: simulator.id,
              simulatorName: simulator.name
            }, appName);
          } catch (error: any) {
            this.logManager.saveDebugData('simulator-boot-failed', {
              simulatorId: simulator.id,
              error: error.message
            }, appName);
            const installError = new InstallCommandFailedError(error.message || error.toString());
            return InstallResult.failed(
              installError,
              request.appPath,
              DeviceId.create(simulator.id),
              simulator.name
            );
          }
        }
      }
      
      // Install the app
      try {
        await this.appInstaller.installApp(
          request.appPath.toString(),
          simulator.id
        );
        
        this.logManager.saveDebugData('install-app-success', {
          simulator: simulator.name,
          simulatorId: simulator.id,
          app: appName
        }, appName);
        
        // Try to get bundle ID from app (could be enhanced later)
        const bundleId = appName; // For now, use app name as bundle ID
        
        return InstallResult.succeeded(
          bundleId,
          DeviceId.create(simulator.id),
          simulator.name,
          request.appPath
        );
      } catch (error: any) {
        this.logManager.saveDebugData('install-app-error', {
          simulator: simulator.name,
          simulatorId: simulator.id,
          app: appName,
          error: error.message
        }, appName);
        
        const installError = new InstallCommandFailedError(error.message || error.toString());
        return InstallResult.failed(
          installError,
          request.appPath,
          DeviceId.create(simulator.id),
          simulator.name
        );
      }
    }
  • Dependency injection factory that wires all adapters, use case, controller, and decorators for the install_app tool.
    static create(): MCPController {
      // Create the shell executor that all adapters will use
      const execAsync = promisify(exec);
      const executor = new ShellCommandExecutorAdapter(execAsync);
    
      // Create infrastructure adapters
      const simulatorLocator = new SimulatorLocatorAdapter(executor);
      const simulatorControl = new SimulatorControlAdapter(executor);
      const appInstaller = new AppInstallerAdapter(executor);
      const logManager = new LogManagerInstance();
    
      // Create the use case with all dependencies
      const useCase = new InstallAppUseCase(
        simulatorLocator,
        simulatorControl,
        appInstaller,
        logManager
      );
    
      // Create the controller
      const controller = new InstallAppController(useCase);
    
      // Create dependency checker
      const dependencyChecker = new DependencyChecker(executor);
    
      // Wrap with dependency checking decorator
      const decoratedController = new DependencyCheckingDecorator(
        controller,
        ['xcrun'],  // simctl is part of xcrun
        dependencyChecker
      );
    
      return decoratedController;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'install' implies a write/mutation operation, the description doesn't specify permissions needed, whether installation is reversible, error conditions (e.g., invalid app path), or what happens on success/failure. This leaves significant gaps for a mutation tool.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/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 is inadequate. It lacks critical context such as what 'install' entails (e.g., overwriting existing apps?), expected return values, error handling, or dependencies on other tools (e.g., requiring a booted simulator). The high schema coverage doesn't compensate for these behavioral gaps.

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%, with both parameters clearly documented in the schema. The description doesn't add any parameter-specific details beyond what's in the schema (e.g., format examples for appPath or simulatorId). With high schema coverage, the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the action ('install') and target resource ('app on the simulator'), making the purpose immediately understandable. It doesn't specifically differentiate from sibling tools like 'boot_simulator' or 'list_simulators', but the verb 'install' is distinct enough for basic differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether the simulator needs to be booted first), exclusions, or relationships with sibling tools like 'boot_simulator' or 'list_simulators'.

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

Install Server

Other Tools

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/Stefan-Nitu/mcp-xcode'

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