Skip to main content
Glama

sandbox_exec

Destructive

This remote connection cannot read or upload files from the person's computer. A local path such as /Users/me/project is not accessible from a box. Do not start a box or run commands merely to probe that laptop path; ask for an accessible repository or an authorized transfer first. Run a bash command on the box. Foreground returns stdout, stderr (the last 16 KB of each; when truncated, outputUrl has it all), exitCode and an execId; background returns a bgId and a log path. pkill -f and pgrep -f match any other job whose command line holds the pattern; sandbox_procs stops one background job by its bgId. Secret and setting values come back as ****. A foreground command's screen changes are recorded, with a screenshot at the end, and shown to the person beside that step (the recording for 7 days, the screenshot for 30); browser and app tests run headed on the display (DISPLAY=:99 is set) show up in that recording. Commands run as root, so Chromium and Electron need --no-sandbox; tests of programs that switch uid need user: "tester". Output is not a TTY, so test runners print CI formats (node --test prints TAP). The clock is UTC and browsers default to en-US: start Chromium with TZ= and --accept-lang= (Playwright: timezoneId, locale). A Chromium window is at least 500 px wide; on the portrait screen (390x844) use --force-device-scale-factor=0.78 --window-size=500,1082 --window-position=0,0 to fill it (only for you; hand over a tab recording). For a page narrower than that, add --remote-debugging-port=9222 and call sandbox_shot target tab with width: the box keeps that viewport. Containers resolve names through the box's DNS at 172.17.0.1: give that to nginx's resolver (127.0.0.11 exists only on user-defined networks). With an environment's AWS role, docker run -e AWS_CONTAINER_CREDENTIALS_FULL_URI -e AWS_REGION gives containers its credentials. The browsers match Playwright 1.56.0: for another version run npx playwright install chromium first. A test starting its own ibus-daemon needs env -u IBUS_ADDRESS.

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": {
      "id": "<id>",
      "cmd": "<cmd>",
      "note": "<note>"
    },
    "name": "sandbox_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesBox id from sandbox_start
cmdYesbash command line. To write a file, use a quoted heredoc (cat > f <<'EOF' … EOF): nothing inside it is expanded and backslashes stay as written. Send big files or many files with sandbox_sync instead of putting them in cmd
cwdNoRelative to /work (default /work)
noteYesOne short sentence, in the language requested by the person (English by default), saying what this step is for ("build the refund service"). The person watching sees it in their app instead of the raw command, as what the box is doing right now. It stays on the box's timeline for 7 days (30 when the step leaves a screenshot), shown to everyone who opens the box: if you will hand it to someone who reads another language (a reviewer, a client), write it in theirs. sandbox_review with clearActivity hides the earlier steps
userNoDefault root. tester runs the command as a non-root user with its own HOME, TMPDIR (/tmp/u<uid>), GOPATH and npm cache; root-owned files under cwd are handed to it so it can write there. Use it for tests of programs that switch uid (setpriv, per-user isolation) or refuse to run as root
strictNoPrepend set -eo pipefail, so exitCode is that of the first failing command or pipeline stage. Without it exitCode is the last command's only: a failing test piped to tee, or followed by another line, reports 0
baselineNoRun the same command in cwd and then in the same place in <dest>-baseline, the earlier tree sandbox_sync baseline sent, and compare the failing tests (go test, node --test, jest, vitest, pytest), timings and numbering ignored: onlyMine fails only with your changes, alreadyFailing in both, fixedByMine only before them. cwd must be inside a dest you synced with baseline. Both full outputs stay in /work/.sbx/logs
readOnlyNoFor a foreground command that only reads (logs, files, status): it runs without DISPLAY and records nothing. Do not use it to look at or drive the screen
readyLogNoWith background: a regular expression (RE2); the job counts as ready once a line of its log matches it, e.g. "Listening on|ready in"
readyPortNoWith background: the job counts as ready once this port accepts connections on 127.0.0.1 or ::1; sandbox_procs wait with until "ready" returns then
tailBytesNoForeground: keep only the last this many bytes of stdout and of stderr (default and max 16384). What comes before is cut: truncated is true and outputUrl links the complete output, both streams in order
backgroundNoReturn a bgId; the process keeps running after the call, output at /work/.sbx/logs/<bgId>.log. Use it for anything that keeps running (dev servers, watchers, emulators): a foreground call returns once its shell exits and does not track what it started with & or setsid (leftoverChildren), and those lose this call's output. sandbox_procs lists, waits for and stops these jobs by bgId. Programs buffer output written to a file: PYTHONUNBUFFERED=1 is set, but put sed -u, grep --line-buffered or stdbuf -oL in a pipeline, or its lines reach the log only when the buffer fills or the job ends. Wrap long scripts' steps in psbx-step <name> -- <command> to see in sandbox_procs which step runs, failed and how long each took
timeoutSecNoForeground timeout, default 600, max 3600. On timeout the whole process group gets SIGKILL, including anything the command started with &. If the call itself is cut off (the connection drops), the command keeps running until it ends or this runs out: the result has an execId, and sandbox_procs wait with bgId set to it returns the result. Over a remote connection from ChatGPT or Codex, which ends a tool call after about 5 minutes, a foreground command still running after about 270 seconds returns stillRunning: true with that execId and keeps running

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / timeoutSec / description
      Previous value: -"Foreground timeout, default 600, max 3600. On timeout the whole process group gets SIGKILL, including anything the command started with &. If the call itself is cut off (the connection drops), the command keeps running until it ends or this runs out: the result has an execId, and sandbox_procs wait with bgId set to it returns the result"New value: +"Foreground timeout, default 600, max 3600. On timeout the whole process group gets SIGKILL, including anything the command started with &. If the call itself is cut off (the connection drops), the command keeps running until it ends or this runs out: the result has an execId, and sandbox_procs wait with bgId set to it returns the result. Over a remote connection from ChatGPT or Codex, which ends a tool call after about 5 minutes, a foreground command still running after about 270 seconds returns stillRunning: true with that execId and keeps running"
  2. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare destructive/openWorld behavior, and the description adds substantial context beyond them: 16 KB truncation with outputUrl, secrets/settings rendered as ****, screen recording retained 7 days (30 with screenshot), commands run as root, non-TTY output, UTC clock, process-group SIGKILL on timeout, and the stillRunning execId handoff after ~270s. A minor gap is that it does not say what a failure of the box itself (as opposed to the command) looks like, but the disclosure otherwise far exceeds the annotation bar.

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

Conciseness2/5

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

Effectively a single dense paragraph that jumps between unrelated topics — path access, output truncation, screen recording retention, DNS at 172.17.0.1, Chromium window sizing, Playwright version pinning, ibus-daemon. Individual facts are useful, but the purpose is not front-loaded and there is no grouping or ordering, making it hard to scan for the sentence relevant to a given call.

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 13-parameter, destructive, open-world execution tool with no output schema, the description covers the return shape (stdout/stderr/exitCode/execId; bgId plus log path), timeouts and cancellation, environment quirks that routinely break commands (no TTY, root uid, no-sandbox flags, TZ/locale), and the human-visible recording side effect. An agent has enough to invoke this correctly and interpret the result.

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% and the per-property descriptions are unusually rich (note wording, strict exit-code semantics, baseline semantics, readyLog/readyPort, tailBytes), so the schema already does the heavy lifting and a baseline of 3 applies. The description body adds little parameter-specific meaning; the few references it makes (pkill/pgrep matching other jobs, sandbox_procs wait with bgId set to an execId) are supplementary rather than clarifying a parameter's type or format.

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?

The core action is a specific verb+resource: "Run a bash command on the box." It also distinguishes itself from siblings by naming behavior boundaries (sandbox_procs stops background jobs, sandbox_sync carries big files, sandbox_shot captures tabs). However, the actual purpose statement is buried in the third sentence behind two sentences of filesystem-access preamble, so an agent skimming the first line does not immediately learn what the tool does.

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?

Explicit when/when-not/alternatives: do not probe a laptop path or start a box to do so; ask for an accessible repo first; use sandbox_sync instead of putting big files in cmd; use background for anything that keeps running; use readOnly for read-only foregrounds; use sandbox_procs to wait on or stop jobs. Exclusions and routing to alternatives are stated outright rather than implied.

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.