Skip to main content
Glama

adb_shell

Destructive

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

NameRequiredDescriptionDefault
cwdNo
rootNo
stdinNo
deviceNo
commandYes
timeoutNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare destructiveHint=true and openWorldHint=true, and the description adds meaningful context beyond that: no TTY, fresh shell per call, command and children killed on timeout, and `root` requiring a rooted device. It does not explain permission/authorization requirements or the exact side effects a destructive command may have, but the safety profile is largely covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the action and return values, then behavioral constraints, then a clean per-parameter Args list. Slightly redundant in places (the timeout kill behavior is stated twice, in prose and in the timeout arg), but nothing is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a high-risk, six-parameter execution tool, the description covers execution model, isolation, timeout semantics, root escalation, stdin, and working directory, and an output schema exists so return values need not be explained. An agent has everything needed to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry the burden. The Args block documents all six parameters meaningfully: command is interpreted by the device shell, device may be omitted with a single attached device, timeout default is 60s from config, and root routes through `su` on rooted devices only.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Run a shell command on the device') and immediately names the return values (exit_code, stdout, stderr). It is clearly distinguishable from siblings like adb_push or adb_read_file.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says non-interactive with no TTY and that each call is a fresh shell, so use `cwd` rather than relying on a previous `cd`. It names the alternative for long-running work ('For long-running work (servers, logcat -f, benchmarks) use adb_job_start') and states the timeout kill behavior as a selection criterion.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.