list_android_devices
Identify connected Android devices and emulators to enable UI analysis, testing, and screenshot capture operations.
Instructions
List all connected Android devices and emulators
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/utils/adb.ts:120-138 (handler)Core handler function that lists connected Android devices using ADB command 'adb devices -l', parses the output, and returns formatted device list.export function getConnectedDevices(): AndroidDevice[] { try { const output = executeADBCommand('devices -l'); const devices = parseDeviceList(output); if (devices.length === 0) { throw new NoDevicesFoundError(); } return devices; } catch (error) { if (error instanceof NoDevicesFoundError) { throw error; } throw new ADBCommandError('FAILED_TO_LIST_DEVICES', 'Failed to list connected devices', { originalError: error instanceof Error ? error.message : String(error), }); } }
- src/server.ts:50-54 (registration)Tool registration in the list of tools provided by the MCP server.{ name: 'list_android_devices', description: 'List all connected Android devices and emulators', inputSchema: ListDevicesToolSchema, },
- src/types.ts:155-159 (schema)MCP tool schema defining the input schema for list_android_devices tool (no required parameters).export const ListDevicesToolSchema = { type: 'object' as const, properties: {}, required: [] as string[], };
- src/types.ts:120-134 (schema)Output schema for the list_android_devices tool response.export const ListDevicesOutputSchema = z.object({ devices: z .array( z.object({ id: z.string().describe('Device ID'), status: z.string().describe('Device status'), model: z.string().optional().describe('Device model'), product: z.string().optional().describe('Product name'), transportId: z.string().optional().describe('Transport ID'), usb: z.string().optional().describe('USB information'), productString: z.string().optional().describe('Product string'), }) ) .describe('List of connected Android devices'), });
- src/server.ts:130-148 (handler)Server-side wrapper that invokes getConnectedDevices and formats the result per output schema.private async listDevices( input: z.infer<typeof ListDevicesInputSchema> ): Promise<z.infer<typeof ListDevicesOutputSchema>> { const devices = getConnectedDevices(); const result = { devices: devices.map(device => ({ id: device.id, status: device.status, model: device.model, product: device.product, transportId: device.transportId, usb: device.usb, productString: device.productString, })), }; return ListDevicesOutputSchema.parse(result); }