Skip to main content
Glama

boot_simulator

Start an iOS simulator device to test and run Apple platform applications directly through Xcode development workflows.

Instructions

Boot a simulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceIdYesDevice UDID or name of the simulator to boot

Implementation Reference

  • The execute method of BootSimulatorController, which implements the MCPController for 'boot_simulator'. Validates input, executes the use case, and formats the response or error.
    async execute(args: unknown): Promise<{ content: Array<{ type: string; text: string }> }> { try { // Cast to expected shape const input = args as { deviceId: unknown }; // Create domain value object - will validate const deviceId = DeviceId.create(input.deviceId); // Create domain request const request = BootRequest.create(deviceId); // 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 other errors consistently const message = ErrorFormatter.format(error); return { content: [{ type: 'text', text: `❌ ${message}` }] }; } }
  • Core use case execution logic for booting simulator: locates simulator, checks state, boots if necessary, handles errors.
    async execute(request: BootRequest): Promise<BootResult> { // Find the simulator const simulator = await this.simulatorLocator.findSimulator(request.deviceId); if (!simulator) { return BootResult.failed( request.deviceId, '', // No name available since simulator wasn't found new SimulatorNotFoundError(request.deviceId) ); } // Check simulator state if (simulator.state === SimulatorState.Booted) { return BootResult.alreadyBooted( simulator.id, simulator.name, { platform: simulator.platform, runtime: simulator.runtime } ); } // Handle Booting state - simulator is already in the process of booting if (simulator.state === SimulatorState.Booting) { return BootResult.alreadyBooted( simulator.id, simulator.name, { platform: simulator.platform, runtime: simulator.runtime } ); } // Handle ShuttingDown state - can't boot while shutting down if (simulator.state === SimulatorState.ShuttingDown) { return BootResult.failed( simulator.id, simulator.name, new SimulatorBusyError(SimulatorState.ShuttingDown) ); } // Boot the simulator (handles Shutdown state) try { await this.simulatorControl.boot(simulator.id); return BootResult.booted( simulator.id, simulator.name, { platform: simulator.platform, runtime: simulator.runtime } ); } catch (error: any) { return BootResult.failed( simulator.id, simulator.name, new BootCommandFailedError(error.stderr || error.message || '') ); } }
  • Input schema definition for the boot_simulator tool, specifying the required 'deviceId' parameter.
    get inputSchema() { return { type: 'object' as const, properties: { deviceId: { type: 'string' as const, description: 'Device UDID or name of the simulator to boot' } }, required: ['deviceId'] as const }; }
  • src/index.ts:111-115 (registration)
    Registration loop that adds BootSimulatorController (created via factory at line 82) to the tools map by name.
    // Register each tool by its name for (const tool of toolInstances) { const definition = tool.getToolDefinition(); this.tools.set(definition.name, tool); }
  • Factory that wires all dependencies to create the BootSimulatorController instance used for the tool.
    export class BootSimulatorControllerFactory { 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); // Create the use case with all dependencies const useCase = new BootSimulatorUseCase( simulatorLocator, simulatorControl ); // Create the controller const controller = new BootSimulatorController(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; }

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