Skip to main content
Glama

shell_exec

Execute shell commands on an Android device through ADB to inspect or control it, returning exit code, stdout, and stderr.

Instructions

Run an arbitrary shell command on the device (run-as-shell of the adb user). Returns exit code, stdout, stderr. Destructive by definition.

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": "shell_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory to cd into first (optional)
commandYesShell command, e.g. 'pm list packages | head'
timeoutNoSeconds before giving up (default 60)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does real work: it declares 'Destructive by definition', names the privilege level (adb shell user), and specifies the exact return payload. It still omits which device the command targets (many siblings imply a selected-device model), whether the call blocks, and whether root-only commands are permitted.

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

Conciseness5/5

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

Three short sentences, verb-first, with the danger warning placed early and the return contract last. No padding, and the most decision-relevant facts lead.

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

Completeness3/5

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

For the highest-risk tool in this catalog it covers destructiveness, privilege level, and outputs, which is the essential core. It falls short on device targeting and execution semantics (blocking, timeout truncation, output size limits) that an agent needs before firing an arbitrary command.

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

Parameters3/5

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

Schema description coverage is 100%, so command, cwd, and timeout are already documented, including the 60-second default. The description adds no syntax, quoting, or timeout-behavior detail beyond the schema, so the baseline of 3 applies.

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 an arbitrary shell command on the device') and adds the execution context ('run-as-shell of the adb user') plus the return contract (exit code, stdout, stderr). This clearly separates it from the task-specific siblings like file_read, app_install, or logcat_dump: it is the general escape hatch.

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

Usage Guidelines3/5

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

The word 'arbitrary' strongly implies this is the fallback when no dedicated tool fits, but that implication is never made explicit. There is no when-to-use/when-not statement, no guidance to prefer app_start or file_ls over raw shell, and no prerequisites such as requiring a selected or connected device.

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