commandstringOne command.
commandsstring[]Several, run in order, in one call.
timeout_msinteger120 000Per command. 600 000 at most.
stop_on_errorbooleantrueStop the sequence at the first non-zero exit code.
backgroundbooleanfalseRun in a terminal that outlives the answer. One command only.
portintegerWith background: the port the server listens on. The terminal publishes it and returns a URL.
descriptionstringA five-word summary, shown to the user.
Several commands in one call
commands: ["npm ci", "npm run build"] is one turn; two calls are two. The instruction to batch is in the tool's own description and in the system prompt, because a model does not do it on its own.
A sequence is approved as a sequence: the user saw three commands in that order, so approving them does not approve any one of them alone later.
Which shell
| Where | Shell |
|---|---|
| A computer running Windows | PowerShell |
| A computer elsewhere | bash |
| A supplied shell bridge | whatever your bridge runs |
| A cloud workspace | bash, and the prompt says so explicitly |
Servers go in the background
bash({ command: "npm run dev -- --host", background: true, port: 5173 })
// → the terminal id, its first output, and a URL# The Python bash tool runs one command and returns when it ends:
# bash {"command": "npm test", "timeout_ms": 120000}
# → {"exitCode": 0, "stdout": "…", "stderr": ""}
# A server that must keep running goes through terminal {"action": "create", "command": "npm run dev"}- Never in the foreground: a server that does not finish is killed at the timeout.
- Never detached with
nohup,&or a job — it would run where the user cannot see or stop it. - Make the server listen on all interfaces (
--host,-H 0.0.0.0), or the URL answers nothing.
The exit code is the signal
The agent is told to check it and fix errors. A shell bridge that always returns zero makes every failure invisible.
It is not always there
On a phone or a cloud workspace with no shell bridge, the tool is not declared at all — nothing would run it.