android_list_emulators
List available Android emulators to manage virtual devices for development and testing.
Instructions
List available Android emulators
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/android.ts:509-534 (handler)The main handler function for the 'android_list_emulators' tool. It executes the 'emulator -list-avds' command, parses the output to list available AVDs, checks running status using the global runningEmulators map, and returns structured data with counts.handler: async () => { const result = await processExecutor.execute('emulator', ['-list-avds']); if (result.exitCode !== 0) { throw new Error(`Emulator listing failed: ${result.stderr}`); } const emulators = result.stdout .split('\n') .map(line => line.trim()) .filter(line => line.length > 0) .map(name => ({ name, isRunning: runningEmulators.has(name), pid: runningEmulators.get(name) || null, })); return { success: true, data: { emulators, totalCount: emulators.length, runningCount: emulators.filter(e => e.isRunning).length, }, }; }
- src/tools/android.ts:501-535 (registration)Registration of the 'android_list_emulators' tool in the createAndroidTools function's tools Map. Includes name, description, empty input schema (no parameters required), and the handler function.tools.set('android_list_emulators', { name: 'android_list_emulators', description: 'List available Android emulators', inputSchema: { type: 'object', properties: {}, required: [] }, handler: async () => { const result = await processExecutor.execute('emulator', ['-list-avds']); if (result.exitCode !== 0) { throw new Error(`Emulator listing failed: ${result.stderr}`); } const emulators = result.stdout .split('\n') .map(line => line.trim()) .filter(line => line.length > 0) .map(name => ({ name, isRunning: runningEmulators.has(name), pid: runningEmulators.get(name) || null, })); return { success: true, data: { emulators, totalCount: emulators.length, runningCount: emulators.filter(e => e.isRunning).length, }, }; } });
- src/tools/android.ts:504-507 (schema)Input schema for the tool, which is an empty object since the tool requires no input parameters.inputSchema: { type: 'object', properties: {}, required: []
- src/tools/android.ts:247-247 (helper)Initialization of the runningEmulators map from the globalProcessMap parameter, used by the handler to check emulator running status.runningEmulators = globalProcessMap;