Skip to main content
Glama

Run an adb shell command

android_shell
Destructive

Executes adb shell commands for device inspection, covering tasks like dumpsys, pm, settings, getprop when dedicated tools are unavailable.

Instructions

Run an arbitrary command on the device via adb shell, for anything the dedicated tools do not cover.

Arguments are passed as an array and are not interpreted by a host shell, so quoting is not a concern. Note that the device's shell still applies its own semantics to things like redirection.

Prefer a dedicated tool when one exists — they parse output and explain failures. Reach for this for one-off inspection: dumpsys, pm, settings, getprop and similar.

Args:

  • command (string[]): command and arguments, e.g. ["dumpsys", "battery"]

  • serial (string, optional): target device

  • timeout_ms (number): command timeout (default: 30000)

Returns: { "stdout": string, "command": string, "serial": string }

Examples:

  • Use when: reading battery state -> command=["dumpsys", "battery"]

  • Use when: listing installed packages -> command=["pm", "list", "packages", "-3"]

  • Use when: checking a system setting -> command=["settings", "get", "global", "window_animation_scale"]

  • Don't use when: a dedicated tool covers it (android_logcat, android_dump_ui, android_tap)

Error Handling:

  • The device shell's own error text is returned verbatim

  • Commands needing root fail on production builds; there is no workaround on a locked device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
serialNoDevice serial from android_list_devices. Optional when exactly one device is connected; required when several are.
commandYesCommand and arguments as separate array elements.
timeout_msNoTimeout in milliseconds.
Behavior5/5

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

The description discloses key behavioral traits beyond annotations: argument passing semantics ('not interpreted by a host shell'), device shell behavior (redirection), error return behavior (device shell's error text verbatim), and root limitations. The destructiveHint annotation is complemented by warning that commands may need root and fail on production builds. No contradiction with annotations.

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?

The description is well-structured with clear sections (purpose, arguments, returns, examples, error handling). Every sentence adds useful information. The examples are concise and instructive. The opening line immediately conveys the tool's purpose and scope without padding.

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?

Given the tool's open-ended nature (arbitrary command execution), the description provides all necessary context: usage boundaries, examples, return value shape, error handling, and device-specific caveats. Although there is no output schema, the 'Returns' field covers the response structure. No gaps for a sophisticated agent.

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 coverage is 100%, so the baseline is 3. The description adds value beyond the schema by explaining why quoting is not a concern, giving concrete examples for each parameter (e.g., command=['dumpsys', 'battery']), and clarifying the optional serial semantics implicitly through context. This extra semantic enrichment justifies a 4.

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?

The description opens with a specific verb+resource: 'Run an arbitrary command on the device via adb shell'. It clearly scopes the tool as a catch-all for anything dedicated tools do not cover, and distinguishes it from siblings by explicitly naming alternatives (android_logcat, android_dump_ui, android_tap) and listing sample use cases (dumpsys, pm, settings, getprop).

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?

The description gives explicit when-to-use guidance ('one-off inspection', 'for anything the dedicated tools do not cover') and when-not-to-use guidance ('Prefer a dedicated tool when one exists'), with concrete examples under 'Don't use when'. It also provides four Use-when example commands, making the selection criteria actionable.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jjs03111/android-build-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server