adb_get_system_info
Retrieve detailed system information from Android devices using a specified Device ID. Facilitates remote device management and diagnostics within the ADB MCP Server framework.
Instructions
Get system information from the device
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deviceId | No | Device ID (optional) |
Implementation Reference
- src/tools/shell.ts:60-107 (handler)The core handler function in ShellTools class that implements 'adb_get_system_info' by executing multiple ADB shell commands (getprop, uname, etc.) to collect and return device system information.async getSystemInfo(deviceId?: string) { try { const connected = await this.adbClient.isDeviceConnected(deviceId); if (!connected) { return { success: false, error: 'Device not connected', message: 'Cannot get system info - device is not connected' }; } const commands = { androidVersion: 'getprop ro.build.version.release', apiLevel: 'getprop ro.build.version.sdk', manufacturer: 'getprop ro.product.manufacturer', model: 'getprop ro.product.model', brand: 'getprop ro.product.brand', device: 'getprop ro.product.device', buildId: 'getprop ro.build.id', kernel: 'uname -r', uptime: 'uptime', meminfo: 'cat /proc/meminfo | head -5', cpuinfo: 'cat /proc/cpuinfo | grep "model name" | head -1' }; const systemInfo: Record<string, string> = {}; for (const [key, cmd] of Object.entries(commands)) { const result = await this.adbClient.executeCommand(`shell ${cmd}`, deviceId); systemInfo[key] = result.success ? result.output.trim() : 'N/A'; } return { success: true, data: { ...systemInfo, deviceId: deviceId || this.adbClient.getDefaultDevice() }, message: 'System information retrieved successfully' }; } catch (error: any) { return { success: false, error: error.message, message: 'Failed to get system info' }; } }
- src/index.ts:373-386 (registration)Tool registration in the MCP server's ListTools response, defining the name, description, and input schema for 'adb_get_system_info'.{ name: 'adb_get_system_info', description: 'Get system information from the device', inputSchema: { type: 'object', properties: { deviceId: { type: 'string', description: 'Device ID (optional)', }, }, required: [], }, },
- src/index.ts:475-476 (handler)Dispatch case in the CallToolRequest handler that routes the tool call to ShellTools.getSystemInfo method.case 'adb_get_system_info': return await this.handleToolCall(this.shellTools.getSystemInfo(args?.deviceId as string));