Skip to main content
Glama

execute_command

Destructive

Run non-interactive shell commands on an authorized remote device and wait for completion, enabling agents to perform one-off operations without an SSH daemon.

Instructions

Run a non-interactive shell command on the selected authorized target device and wait for completion. This can modify or delete files and perform any operation allowed to the target user; obtain user approval for destructive commands. client_token is required with management access (including stdio and no-password mode); client_id is required for multi-device tokens. Each call starts a fresh shell: set cwd and env explicitly; changes do not persist between calls. timeout_ms defaults to 60000 (60 seconds), 0 disables the timeout, and the maximum is 86400000 (24 hours). Captured stdout and stderr share a 1 MiB limit; excess output is discarded and truncated=true. The result contains stdout, stderr, exit_code, timed_out, canceled, truncated and optional error; a nonzero exit, timeout, cancellation or execution failure sets isError. Canceling the MCP request sends a best-effort cancellation request; it does not undo effects already performed. Commands are not automatically retried. Use session_start/read/write/stop for prompts, incremental output or long-running jobs.

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory on the target device. Each command starts a fresh shell; use cwd for subsequent commands instead of relying on a previous cd.
envNoEnvironment overrides for this command, merged with the client environment. Values must be strings.
commandYesShell command
client_idNoSix lowercase letters or digits from list_clients. Required for multi-device tokens, even when only one device is online; optional for single-device tokens.
timeout_msNoExecution timeout in milliseconds, up to 86400000 (24 hours). 0 disables the timeout. Default: 60000 for execute_command, 0 for session_start.
client_tokenYesTarget client connection token, required with management access (including stdio and no-password mode). Device-scoped bearer access implicitly selects its own token.

Output Schema

NameRequiredDescriptionDefault
errorNoOptional execution or connection error. A disconnect does not prove the remote process completed successfully.
stderrYesCaptured standard error, sharing a 1 MiB combined limit with stdout.
stdoutYesCaptured standard output, sharing a 1 MiB combined limit with stderr.
canceledYesTrue only when the target reported cancellation; a disconnect alone does not confirm cancellation.
exit_codeYesReported process exit code: 0 means success; -1 means execution failed, was interrupted, or the device disconnected before a normal exit report.
timed_outYesTrue if the target reported that the process execution timeout elapsed.
truncatedYesTrue if output exceeded the 1 MiB retention limit. Commands discard excess captured output; sessions discard older buffered bytes.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv0.3.1-stdio.2
    • changedInput schema / properties / client_token / description
      Previous value: -"Target client connection token (required when authenticated with the management key)"New value: +"Target client connection token, required with management access (including stdio and no-password mode). Device-scoped bearer access implicitly selects its own token."
    • addedOutput schema / properties / canceled / description
      Added value: +"True only when the target reported cancellation; a disconnect alone does not confirm cancellation."
    • addedOutput schema / properties / error / description
      Added value: +"Optional execution or connection error. A disconnect does not prove the remote process completed successfully."
    • addedOutput schema / properties / exit_code / description
      Added value: +"Reported process exit code: 0 means success; -1 means execution failed, was interrupted, or the device disconnected before a normal exit report."
    • addedOutput schema / properties / stderr / description
      Added value: +"Captured standard error, sharing a 1 MiB combined limit with stdout."
    • addedOutput schema / properties / stdout / description
      Added value: +"Captured standard output, sharing a 1 MiB combined limit with stderr."
    • addedOutput schema / properties / timed_out / description
      Added value: +"True if the target reported that the process execution timeout elapsed."
    • addedOutput schema / properties / truncated / description
      Added value: +"True if output exceeded the 1 MiB retention limit. Commands discard excess captured output; sessions discard older buffered bytes."
  2. First observedv0.3.1-stdio.1

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond annotations: warns that commands can modify/delete files and require user approval for destructive ones, that each call starts a fresh shell with no persistence, documents timeout defaults/limits, the 1 MiB shared stdout/stderr cap with truncation, the result field set, error semantics, and that cancellation is best-effort and does not undo effects. These are real operational constraints an agent cannot infer from destructiveHint/openWorldHint alone.

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-loads the purpose and danger warning, then proceeds through auth, shell semantics, timeout, output limits and result shape. Dense but well ordered; the result-field enumeration is borderline verbose given an output schema exists, which costs a point.

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?

Covers everything an agent needs for a destructive, open-world, non-idempotent tool: approval guidance, auth requirements per token type, non-persistence of shell state, timeout bounds, output truncation, error signaling, cancellation limits, no retry, and sibling routing. The output schema's existence makes the brief result listing sufficient rather than redundant.

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?

With 100% schema coverage the baseline is 3, but the description adds cross-parameter meaning: client_token is required with management access (including stdio/no-password mode), client_id is required for multi-device tokens, and cwd/env must be set per call because shells are fresh. These reinforce and contextualize the schema rather than merely restating it.

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+resource ('Run a non-interactive shell command') plus the scope ('on the selected authorized target device and wait for completion'). It explicitly distinguishes itself from the session_* siblings by naming them as the alternative for prompts, incremental output and long-running jobs.

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

Usage Guidelines4/5

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

The last sentence explicitly routes agents to session_start/read/write/stop for interactive or long-running scenarios, which is a clear use-vs-alternative rule. It gives no explicit exclusions for execute_command itself beyond the 'non-interactive' framing, so it falls short of a full when/when-not treatment.

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