adb_get_device_info
Retrieve detailed information about an Android device for management and debugging purposes, using its device ID or default settings, through the ADB MCP Server.
Instructions
Get detailed information about a specific device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | Device ID (optional, uses default device if not specified) |
Implementation Reference
- src/index.ts:61-73 (schema)Tool schema definition in ListTools response, specifying input parameters for the adb_get_device_info tool.name: 'adb_get_device_info', description: 'Get detailed information about a specific device', inputSchema: { type: 'object', properties: { deviceId: { type: 'string', description: 'Device ID (optional, uses default device if not specified)', }, }, required: [], }, },
- src/index.ts:435-436 (registration)Tool registration in the CallToolRequestSchema switch statement, dispatching to DeviceTools.getDeviceInfo handler.case 'adb_get_device_info': return await this.handleToolCall(this.deviceTools.getDeviceInfo(args?.deviceId as string));
- src/tools/device.ts:23-37 (handler)Direct tool handler method in DeviceTools class that invokes AdbClient.getDeviceInfo and formats the success/error response.async getDeviceInfo(deviceId?: string) { try { const deviceInfo = await this.adbClient.getDeviceInfo(deviceId); return { success: true, data: deviceInfo, message: `Device info retrieved for ${deviceInfo.id}` }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to get device info' }; }
- src/adb-client.ts:73-108 (helper)Core helper method in AdbClient that executes ADB shell commands to fetch detailed device information including model, manufacturer, Android version, API level, and screen size.async getDeviceInfo(deviceId?: string): Promise<DeviceInfo> { const device = deviceId || this.defaultDevice; if (!device) { throw new Error('No device specified'); } const commands = { model: 'shell getprop ro.product.model', manufacturer: 'shell getprop ro.product.manufacturer', androidVersion: 'shell getprop ro.build.version.release', apiLevel: 'shell getprop ro.build.version.sdk', screenSize: 'shell wm size' }; const results: Record<string, string> = {}; for (const [key, command] of Object.entries(commands)) { const result = await this.executeCommand(command, device); results[key] = result.success ? result.output : ''; } // Parse screen size const screenMatch = results.screenSize.match(/(\d+)x(\d+)/); const screenSize = screenMatch ? { width: parseInt(screenMatch[1]), height: parseInt(screenMatch[2]) } : { width: 0, height: 0 }; return { id: device, model: results.model, manufacturer: results.manufacturer, androidVersion: results.androidVersion, apiLevel: parseInt(results.apiLevel) || 0, screenSize }; }