Skip to main content
Glama

killDevice

Terminate a running device on the AutoMobile MCP server by specifying the device name, unique ID, and platform (Android or iOS).

Instructions

Kill a running device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYes

Implementation Reference

  • MCP tool handler for 'killDevice'. Instantiates DeviceUtils and calls killDevice on the target device, returning a success response or throwing an error.
    const killDeviceHandler = async (args: KillDeviceArgs) => { try { const deviceUtils = new DeviceUtils(); await deviceUtils.killDevice(args.device); return createJSONToolResponse({ message: `${args.device.platform} '${args.device.name}' shutdown successfully`, udid: args.device.name, name: args.device.name, platform: args.device.platform }); } catch (error) { throw new ActionableError(`Failed to kill ${args.device.platform} device: ${error}`); } };
  • Zod schema defining the input arguments for the killDevice tool: device object with name, deviceId, and platform.
    export const killDeviceSchema = z.object({ device: z.object({ name: z.string().describe("The device image name to kill"), deviceId: z.string().describe("The device unique ID"), platform: z.enum(["android", "ios"]).describe("Target platform") }) });
  • Registration of the 'killDevice' tool with ToolRegistry, including name, description, schema, and handler.
    ToolRegistry.register( "killDevice", "Kill a running device", killDeviceSchema, killDeviceHandler );
  • DeviceUtils helper method that routes killDevice call to platform-specific emulator or simctl based on device.platform.
    async killDevice( device: BootedDevice ): Promise<void> { switch (device.platform) { case "android": return this.emulator.killDevice(device); case "ios": return this.simctl.killSimulator(device); } }
  • AndroidEmulator.killDevice implementation that uses ADB 'emu kill' command to shut down the running emulator.
    async killDevice(device: BootedDevice): Promise<void> { const runningEmulators = await this.getBootedDevices(); const emulator = runningEmulators.find(emu => emu.deviceId === device.deviceId); if (!emulator || !emulator.deviceId) { throw new ActionableError(`Emulator '${device.name}' is not running`); } // Use ADB to stop the emulator const adb = new AdbUtils(emulator); await adb.executeCommand("emu kill"); logger.info(`Killed emulator '${device.name}'`); }

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