Skip to main content
Glama

ios_boot_simulator

Start an iOS simulator for testing and development by providing its unique device identifier. This tool enables developers to launch virtual iOS devices for app testing.

Instructions

Boot an iOS simulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
udidYesSimulator UDID

Implementation Reference

  • Executes the ios_boot_simulator tool: validates input with Zod schema, checks macOS platform, validates UDID format, runs 'xcrun simctl boot' with timeout, handles already-booted case (exit 164), returns structured success response.
    handler: async (args: any) => { checkMacOS(); const validation = IosSimulatorActionSchema.safeParse(args); if (!validation.success) { throw new Error(`Invalid request: ${validation.error.message}`); } const { udid } = validation.data; // Validate UDID format if (!validateUDID(udid)) { throw new Error(`Invalid simulator UDID format. UDID must be in format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX: ${udid}`); } const result = await processExecutor.execute('xcrun', ['simctl', 'boot', udid], { timeout: 60000, // 1 minute timeout for simulator boot }); // Note: simctl boot returns exit code 164 if simulator is already booted, which is not an error if (result.exitCode !== 0 && result.exitCode !== 164) { throw new Error(`Failed to boot iOS simulator: ${result.stderr}`); } const isAlreadyBooted = result.exitCode === 164; return { success: true, data: { udid, status: isAlreadyBooted ? 'already_booted' : 'booted', message: isAlreadyBooted ? 'Simulator was already booted' : 'Simulator booted successfully', output: result.stdout, }, }; }
  • Registers the ios_boot_simulator tool in the tools Map returned by createIOSTools(), defining name, description, JSON inputSchema, and inline handler function.
    tools.set('ios_boot_simulator', { name: 'ios_boot_simulator', description: 'Boot an iOS simulator', inputSchema: { type: 'object', properties: { udid: { type: 'string', minLength: 1, description: 'Simulator UDID' } }, required: ['udid'] }, handler: async (args: any) => { checkMacOS(); const validation = IosSimulatorActionSchema.safeParse(args); if (!validation.success) { throw new Error(`Invalid request: ${validation.error.message}`); } const { udid } = validation.data; // Validate UDID format if (!validateUDID(udid)) { throw new Error(`Invalid simulator UDID format. UDID must be in format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX: ${udid}`); } const result = await processExecutor.execute('xcrun', ['simctl', 'boot', udid], { timeout: 60000, // 1 minute timeout for simulator boot }); // Note: simctl boot returns exit code 164 if simulator is already booted, which is not an error if (result.exitCode !== 0 && result.exitCode !== 164) { throw new Error(`Failed to boot iOS simulator: ${result.stderr}`); } const isAlreadyBooted = result.exitCode === 164; return { success: true, data: { udid, status: isAlreadyBooted ? 'already_booted' : 'booted', message: isAlreadyBooted ? 'Simulator was already booted' : 'Simulator booted successfully', output: result.stdout, }, }; } });
  • Zod validation schema used by ios_boot_simulator (and similar tools) to validate required 'udid' input parameter.
    const IosSimulatorActionSchema = z.object({ udid: z.string().min(1), });
  • Helper function to validate iOS simulator UDID format (UUID v4 pattern), called in the handler.
    const validateUDID = (udid: string): boolean => { const uuidPattern = /^[A-F0-9]{8}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{12}$/i; return uuidPattern.test(udid); };
  • Helper function to enforce macOS platform requirement, called at start of handler.
    const checkMacOS = (): void => { if (process.platform !== 'darwin') { throw new Error(`iOS development tools only work on macOS. Current platform: ${process.platform}`); } };

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/cristianoaredes/mcp-mobile-server'

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