adb_shell
Execute ADB shell commands on Android devices to automate tasks, inspect system information, and control device functionality through direct command-line access.
Instructions
Run an arbitrary ADB shell command
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Shell command to execute on the device | |
| device_id | No | Device ID (optional if only one device) |
Implementation Reference
- src/index.ts:500-511 (handler)Registration and implementation handler for the 'adb_shell' tool in index.ts. It calls the adb.shell method.
server.tool( "adb_shell", "Run an arbitrary ADB shell command", { command: z.string().describe("Shell command to execute on the device"), device_id: z.string().optional().describe("Device ID (optional if only one device)"), }, async ({ command, device_id }) => { const output = await adb.shell(command, device_id); return { content: [{ type: "text", text: output || "(no output)" }] }; }, ); - src/adb.ts:359-361 (helper)The actual implementation of the shell command execution in the ADB client class.
async shell(command: string, deviceId?: string): Promise<string> { return this.exec(["shell", command], deviceId); }