Run command
run_commandRun a shell command (/bin/sh -c) in the sandbox as root and wait for it to finish; returns exit_code, stdout, stderr and duration. Without sandbox_id it runs in the current sandbox (one is created if there is none); a sandbox_id you pass becomes the current sandbox. Use it for installs, quick checks and anything that finishes within a few minutes; a non-zero exit code is a normal result to react to, not a tool error. Multi-line programs are simpler to run as code with an interpreter, and long or parallel work belongs in a background job, which keeps running without this connection. To keep a server running, start it in the background (nohup … &).
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": {
"command": "<command>"
},
"name": "run_command"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory | |
| env | No | Environment variables | |
| command | Yes | Command, e.g. 'pip install pandas && python3 script.py' | |
| timeout_s | No | Time limit in seconds (default 120, max 3600) | |
| sandbox_id | No | Sandbox ID (sb_…). If omitted, the current sandbox of this session is used. A sandbox_id you pass becomes the current sandbox for later calls without sandbox_id. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stderr | Yes | Standard error output. | |
| stdout | Yes | Standard output (very long output is shortened in the middle). | |
| exit_code | Yes | Exit code of the command (non-zero is a normal result, not a tool error). | |
| shortened | Yes | stdout or stderr was shortened in the middle for this reply (a marker shows how many characters are missing). | |
| timed_out | Yes | The time limit was exceeded and the process was killed. | |
| truncated | Yes | stdout or stderr is incomplete (either of the two reasons below) – redirect large output to a file and read the part you need. | |
| sandbox_id | Yes | Sandbox ID. | |
| duration_ms | Yes | How long the command ran, in milliseconds. | |
| output_limit_hit | Yes | The command produced more than 1 MB of output and the rest was cut off in the sandbox. |