adb_shell
Run a non-interactive shell command on an Android device via ADB and return exit code, stdout, and stderr for automation or debugging.
Instructions
Run a shell command on the device and return exit_code, stdout and stderr.
Non-interactive (no TTY). Each call is a fresh shell, so use cwd instead of relying on a
previous cd. On timeout the command and its children are killed. For long-running work
(servers, logcat -f, benchmarks) use adb_job_start.
Args:
command: shell command line, interpreted by the device's shell.
device: configured name or serial; may be omitted when only one device is attached.
timeout: seconds before the command is killed (default from config, 60s).
cwd: directory to run the command in.
stdin: text fed to the command's standard input.
root: run through su (rooted devices only).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"command": "<command>"
},
"name": "adb_shell"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| root | No | ||
| stdin | No | ||
| device | No | ||
| command | Yes | ||
| timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||