Skip to main content
Glama

Execute a command in a sandbox

run_command

Execute commands in a boat.dev sandbox synchronously or in the background, with optional live streaming and configurable timeouts for automation and debugging.

Instructions

Execute a command in a sandbox. Runs the command synchronously by default (timeout configurable via timeoutSeconds, 600s cap). With detached: true the command starts in the background and a process id is returned immediately; poll /sandboxes/{sandboxId}/commands/{processId} for status and logs. With stream: true the output arrives as the command writes it, as newline-delimited JSON (application/x-ndjson): {"type":"started"}, then {"type":"stdout"|"stderr","data":"..."} per chunk, and last {"type":"exit",...} (the synchronous result without stdout/stderr) or {"type":"error","error":"...","message":"..."}. Returns 400 invalid_timeout when timeoutSeconds is not an integer in 1-600. A command sent while the sandbox is still starting (right after a resume) waits up to 60s for it to be ready instead of failing; 409 boat_starting (retryable) is returned only if it is still not ready by then. A sandbox that is not starting (error, stopped) returns 409 sandbox_not_ready with retryable: false and its state at once: resume or recover it first. Command execution is never retried automatically: a 502 boat_direct_failed means the command may already be running on the sandbox. Every command and its output are kept 7 days in the command history (/sandboxes/{sandboxId}/command-history), readable while the sandbox is stopped.

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": {
      "sandboxId": "<sandboxId>",
      "command": "<command>"
    },
    "name": "run_command"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoRelative working directory inside the sandbox work directory.
streamNoStream the output as the command writes it: the response is newline-delimited JSON (application/x-ndjson), one CommandStreamFrame per line. Ignored with detached.
commandYes
detachedNoStart the command in the background and return a process id immediately instead of waiting for it to finish. Output goes to a log file on the sandbox; poll the status endpoint for it.
sandboxIdYesPublic Sandbox id returned by create/list/get sandbox calls.
timeoutSecondsNoCommand timeout in seconds. Values outside 1-600 are rejected with a 400 invalid_timeout error.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.0

TDQS

A4.3/5.0
Behavior5/5

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

Goes well beyond the annotations: it specifies the 600s timeout cap and 400 invalid_timeout, the 60s readiness wait after a resume, the retryable 409 boat_starting vs non-retryable 409 sandbox_not_ready with state, that execution is never auto-retried and a 502 boat_direct_failed may mean the command already ran, and the 7-day command-history retention. That last detail matters because the annotations declare destructiveHint=false and idempotentHint=false while arbitrary shell commands can mutate sandbox state, so the description's warning context is genuinely load-bearing.

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 core action, then modes, then error semantics, then retention. Dense but almost every clause carries actionable information; the 400 invalid_timeout sentence partially repeats the schema's own description, which is the only clear redundancy.

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 6-parameter, non-idempotent execution tool with no output schema, the description supplies result shapes for all three modes, the full failure taxonomy with retryability, and where output persists afterward. An agent has enough to call it and interpret both success and failure without further guessing.

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 already 83%, so the baseline is 3, but the description adds value the schema cannot: the NDJSON frame sequence (started / stdout|stderr / exit|error) for `stream`, the fact that `stream` is ignored with `detached`, and the error mapping for out-of-range `timeoutSeconds`. It leaves `cwd` and `sandboxId` entirely to the schema, which is acceptable given their coverage.

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

Purpose4/5

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

Uses a specific verb+resource ('Execute a command in a sandbox') that matches the title and is unmistakably distinct from file-search or sandbox-lifecycle siblings. It never names the actual sibling tools (get_command_status, get_command_logs, stop_command, list_command_history), only raw API paths, so the differentiation requires the agent to map endpoints to tool names itself.

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?

Strong conditional guidance on the three operating modes: synchronous by default, `detached: true` for background + polling, `stream: true` for incremental NDJSON output. The gap is that it routes follow-up work to HTTP endpoints ('/sandboxes/{sandboxId}/commands/{processId}') rather than to the sibling tools that implement them, and it never states when not to use this tool.

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