Skip to main content
Glama

Run a command in a sandbox

sandbox_exec

Run a command in a sandbox. Runs one command in the sandbox with /bin/sh -lc and answers its exit code and output. A sandbox that is still starting is waited for (up to a minute). The sandbox's own env is set, under the command's. Use ?stream=1 for commands that run longer than about 90 seconds.

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

Input Schema

NameRequiredDescriptionDefault
cwdNo
envNo
streamNo
commandYes
sandboxIdYes
timeoutMsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior4/5

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

Annotations only state the mutation/safety profile (readOnly=false, destructive=false, idempotent=false), leaving the real behavior to the description, which discloses the shell invocation (`/bin/sh -lc`), that exit code and output are returned, that a starting sandbox is waited on for up to a minute, and that the sandbox `env` is applied beneath the command's `env`. It does not say what happens when timeoutMs elapses (process killed? partial output?) or whether the process tree is terminated, which is the main remaining behavioral gap.

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?

Four short sentences, front-loaded with the core action, then execution mechanics, then the waiting behavior, then the streaming hint. No filler, though the env-precedence sentence is terse enough to require re-reading.

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?

There is no output schema, and the description does cover returns at a high level ('exit code and output'), which is the right thing to include. For a 6-parameter tool with zero schema descriptions and a timeout knob, however, the description omits what timeoutMs and cwd do and what a timeout produces, leaving an agent guessing on failure semantics.

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 0% across 6 parameters, so the description carries the full burden and only partially discharges it: it explains env precedence and mentions streaming for long commands. `cwd`, `timeoutMs` (default 60000, max 600000), and the accepted `stream` enum values are left undocumented, and the phrasing `?stream=1` suggests a query-string parameter rather than the string enum property actually declared in the schema, which can mislead the caller.

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?

States a specific verb and resource ('Run a command in a sandbox') and immediately specifies the execution semantics ('with `/bin/sh -lc`'). It is distinguishable from file-oriented siblings like sandbox_write_file, but it never contrasts itself with vm_exec, the closest-looking alternative in the sibling list.

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?

Gives one concrete routing rule internal to the tool: use `?stream=1` for commands running longer than about 90 seconds, plus implicit guidance that no manual wait is needed while a sandbox starts. There is no when-to-use/when-not-to-use guidance versus vm_exec or versus using sandbox_write_file for non-execution changes, so selection between tools is left to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.