Skip to main content
Glama

startDevice

Initiate a device with the specified device image, including name, source, and platform, for mobile automation testing using the AutoMobile MCP server.

Instructions

Start a device with the specified device image

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYes
timeoutMsNoMaximum time to wait for device to be ready in milliseconds

Implementation Reference

  • The MCP tool handler for 'startDevice' that orchestrates device startup using DeviceUtils.startDevice and waits for readiness, providing progress updates and returning device info.
    const startDeviceHandler = async (args: startDeviceArgs, progress?: ProgressCallback) => { try { const deviceUtils = new DeviceUtils(); const childProcess = await deviceUtils.startDevice(args.device); if (progress) { await progress(60, 100, "Device started, waiting for readiness..."); } // Wait for device to be ready const readyDevice = await deviceUtils.waitForDeviceReady(args.device, args.timeoutMs); if (progress) { await progress(100, 100, "Device is ready for use"); } return createJSONToolResponse({ message: `${args.device.platform} '${args.device.name}' started and is ready`, name: readyDevice.name, processId: childProcess.pid, isReady: true, deviceId: readyDevice.deviceId, source: args.device.source, platform: args.device.platform }); } catch (error) { throw new ActionableError(`Failed to start ${args.device.platform} device: ${error}`); } };
  • Zod schema defining the input parameters for the startDevice tool.
    export const startDeviceSchema = z.object({ localDevice: z.object({ name: z.string().describe("The device name to start"), deviceId: z.string().optional().describe("The device ID") }), platform: z.enum(["android", "ios"]).describe("Target platform") });
  • Registration of the startDevice tool with ToolRegistry, including name, description, schema, handler, and progress support flag.
    ToolRegistry.register( "startDevice", "Start a device with the specified device image", startDeviceSchema, startDeviceHandler, true // Supports progress notifications );
  • Supporting utility method in DeviceUtils class that starts the device by delegating to platform-specific tools (AndroidEmulator or Simctl). Called by the main handler.
    async startDevice( device: DeviceInfo ): Promise<ChildProcess> { switch (device.platform) { case "android": return this.emulator.startEmulator(device.name); case "ios": return this.simctl.startSimulator(device.name); default: throw new ActionableError("Unknown 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/zillow/auto-mobile'

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