Skip to main content
Glama

adb_list_devices

List all connected Android devices to identify available targets for debugging, automation, or management tasks.

Instructions

List all connected Android devices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'adb_list_devices' tool. Calls AdbClient.getDevices() and formats the response with success status and message.
    async listDevices() { try { const devices = await this.adbClient.getDevices(); return { success: true, data: devices, message: `Found ${devices.length} device(s)` }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to list devices' }; } }
  • Core helper function that executes 'adb devices -l' command, parses the output, and returns structured list of AdbDevice objects.
    async getDevices(): Promise<AdbDevice[]> { const result = await this.executeCommand('devices -l'); if (!result.success) { throw new Error(`Failed to get devices: ${result.error}`); } const devices: AdbDevice[] = []; const lines = result.output.split('\n').slice(1); // Skip header line for (const line of lines) { if (line.trim()) { const parts = line.split(/\s+/); if (parts.length >= 2) { const device: AdbDevice = { id: parts[0], status: parts[1] as AdbDevice['status'] }; // Parse additional info if available for (let i = 2; i < parts.length; i++) { const [key, value] = parts[i].split(':'); if (key === 'model') device.model = value; if (key === 'product') device.product = value; if (key === 'transport') device.transport = value; } devices.push(device); } } } return devices; }
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    { name: 'adb_list_devices', description: 'List all connected Android devices', inputSchema: { type: 'object', properties: {}, required: [], }, },
  • src/index.ts:433-434 (registration)
    Registration in the tool call switch statement that dispatches execution to the handler.
    case 'adb_list_devices': return await this.handleToolCall(this.deviceTools.listDevices());

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/richard0913/adb-mcp'

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