get_device_info
Retrieve detailed Android device specifications including model, Android version, SDK version, screen size, brand, and manufacturer for connected devices.
Instructions
Get detailed information about a connected Android device including model, Android version, SDK version, screen size, brand, and manufacturer
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_device_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device_id | No | Device serial number. If omitted, uses the only connected device. |
Implementation Reference
- src/adb/device-manager.ts:69-104 (handler)The core logic for gathering device information using ADB shell commands.
async getDeviceInfo(deviceId?: string): Promise<DeviceInfo> { const resolvedId = await this.resolveDeviceId(deviceId); const [modelResult, versionResult, sdkResult, sizeResult, brandResult, mfgResult] = await Promise.all([ adbShell(['getprop', 'ro.product.model'], resolvedId), adbShell(['getprop', 'ro.build.version.release'], resolvedId), adbShell(['getprop', 'ro.build.version.sdk'], resolvedId), adbShell(['wm', 'size'], resolvedId), adbShell(['getprop', 'ro.product.brand'], resolvedId), adbShell(['getprop', 'ro.product.manufacturer'], resolvedId), ]); // Parse screen size: "Physical size: 1080x1920" const sizeMatch = sizeResult.stdout.match(/(\d+)x(\d+)/); const screenWidth = sizeMatch ? parseInt(sizeMatch[1], 10) : undefined; const screenHeight = sizeMatch ? parseInt(sizeMatch[2], 10) : undefined; const info: DeviceInfo = { id: resolvedId, status: 'device', model: modelResult.stdout.trim(), androidVersion: versionResult.stdout.trim(), sdkVersion: sdkResult.stdout.trim(), screenWidth, screenHeight, brand: brandResult.stdout.trim(), manufacturer: mfgResult.stdout.trim(), }; // Cache screen size in session if (screenWidth && screenHeight) { this.updateSession(resolvedId, screenWidth, screenHeight); } return info; } - src/controllers/device-tools.ts:43-62 (registration)Registration of the 'get_device_info' MCP tool, which invokes the DeviceManager handler.
server.registerTool( 'get_device_info', { description: 'Get detailed information about a connected Android device including model, Android version, SDK version, screen size, brand, and manufacturer', inputSchema: { device_id: z.string().optional().describe('Device serial number. If omitted, uses the only connected device.'), }, }, async ({ device_id }) => { return await metrics.measure('get_device_info', device_id || 'default', async () => { const info = await deviceManager.getDeviceInfo(device_id); return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, device: info }, null, 2), }], }; }); } );