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
| Name | Required | Description | Default |
|---|---|---|---|
| device | Yes |
Implementation Reference
- src/server/deviceTools.ts:136-149 (handler)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}`); } };
- src/server/deviceTools.ts:24-30 (schema)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") }) });
- src/server/deviceTools.ts:174-179 (registration)Registration of the 'killDevice' tool with ToolRegistry, including name, description, schema, and handler.ToolRegistry.register( "killDevice", "Kill a running device", killDeviceSchema, killDeviceHandler );
- src/utils/deviceUtils.ts:99-108 (helper)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}'`); }