Run a device shell command
shellRun arbitrary Android commands via ADB, returning stdout/stderr. Use when dedicated tools don't cover the task.
Instructions
Escape hatch: run an arbitrary command through adb shell on one device and return stdout/stderr. Powerful but not read-only — destructive commands are refused by default (reboot, su, mkfs, wipe, rm of / including split/reordered flags and the /* glob, and pipelines into sh/bash such as curl … | sh or … | sudo bash). This is a guardrail, not a sandbox: a deliberately obfuscated command can still get through. Prefer the dedicated tools (list_packages, install_apk, get_ui_hierarchy, …) when they cover the job. A non-zero remote exit code is reported as exit_code: N in the output. If the call times out, only the host-side adb client is killed; the command keeps running on the device (inherent to adb).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device | No | Device serial from list_devices; optional when exactly one device is connected. | |
| command | Yes | Device shell command, e.g. "dumpsys battery" or "ls /sdcard/Download". | |
| timeout_ms | No | Command timeout in milliseconds (default 30000). |