Skip to main content
Glama

list_android_devices

Identify connected Android devices and emulators to enable UI analysis and testing workflows. This tool provides device listing for screenshot capture and management.

Instructions

List all connected Android devices and emulators

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:50-54 (registration)
    Registration of the 'list_android_devices' tool in the ListToolsRequestHandler, including name, description, and input schema reference.
    { name: 'list_android_devices', description: 'List all connected Android devices and emulators', inputSchema: ListDevicesToolSchema, },
  • Tool dispatch handler for 'list_android_devices': parses input, calls listDevices method, and formats response as JSON text.
    case 'list_android_devices': { const input = ListDevicesInputSchema.parse(args); const result = await this.listDevices(input); return { content: [ { type: 'text', text: JSON.stringify(result), }, ], }; }
  • Private listDevices method: fetches devices using getConnectedDevices helper, maps fields, and validates 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); }
  • Output schema for list_android_devices tool defining the structure of the devices array.
    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'), });
  • Core helper function getConnectedDevices: executes 'adb devices -l', parses output, handles errors.
    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), }); } }
Install Server

Other Tools

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/infiniV/Android-Ui-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server