Skip to main content
Glama

android_stop_emulator

Stop a running Android emulator by specifying its AVD name to free system resources and manage development environments.

Instructions

Stop a running Android emulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
avdNameYesAVD name to stop

Implementation Reference

  • Handler function that validates input, retrieves the emulator PID from tracking map, sends SIGTERM signal to stop it, removes from tracking, handles case where process already terminated.
    handler: async (args: any) => { const validation = AndroidEmulatorStopSchema.safeParse(args); if (!validation.success) { throw new Error(`Invalid request: ${validation.error.message}`); } const { avdName } = validation.data; const pid = runningEmulators.get(avdName); if (!pid) { throw new Error(`Emulator is not running or not tracked by this server. No running emulator found for AVD: ${avdName}`); } try { // Kill the process process.kill(pid, 'SIGTERM'); // Remove from tracking runningEmulators.delete(avdName); return { success: true, data: { avdName, pid, status: 'stopped', }, }; } catch (killError) { // Process might already be dead runningEmulators.delete(avdName); return { success: true, data: { avdName, pid, status: 'already_stopped', message: 'Process was already terminated', }, }; } }
  • Zod validation schema for the android_stop_emulator tool input, requiring 'avdName' as a non-empty string.
    * Zod validation schema for android_stop_emulator tool. * * @type {z.ZodObject} * @property {string} avdName - AVD name to stop */ const AndroidEmulatorStopSchema = z.object({ avdName: z.string().min(1), });
  • Registration of the 'android_stop_emulator' tool in the tools Map returned by createAndroidTools function, including name, description, inputSchema, and handler reference.
    tools.set('android_stop_emulator', { name: 'android_stop_emulator', description: 'Stop a running Android emulator', inputSchema: { type: 'object', properties: { avdName: { type: 'string', minLength: 1, description: 'AVD name to stop' } }, required: ['avdName'] }, handler: async (args: any) => { const validation = AndroidEmulatorStopSchema.safeParse(args); if (!validation.success) { throw new Error(`Invalid request: ${validation.error.message}`); } const { avdName } = validation.data; const pid = runningEmulators.get(avdName); if (!pid) { throw new Error(`Emulator is not running or not tracked by this server. No running emulator found for AVD: ${avdName}`); } try { // Kill the process process.kill(pid, 'SIGTERM'); // Remove from tracking runningEmulators.delete(avdName); return { success: true, data: { avdName, pid, status: 'stopped', }, }; } catch (killError) { // Process might already be dead runningEmulators.delete(avdName); return { success: true, data: { avdName, pid, status: 'already_stopped', message: 'Process was already terminated', }, }; } } });
  • Metadata entry in TOOL_REGISTRY defining category, platform, requirements, and performance expectations for the tool.
    'android_stop_emulator': { name: 'android_stop_emulator', category: ToolCategory.ESSENTIAL, platform: 'android', requiredTools: [RequiredTool.ADB], description: 'Stop running Android emulator', safeForTesting: false, performance: { expectedDuration: 5000, timeout: 30000 }
  • Mapping in validation script indicating the tool requires 'adb' for operation.
    'android_stop_emulator': 'adb',

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