Tools · Files and code
bash
Changes thingsRun a shell command in the project root: tests, builds, git, package managers, scripts. Risky commands (deleting, publishing, writing outside the project) need approval.
When to use: Run shell commands in the project: inspect, search, test, build. Commands that delete, publish, or reach outside the project need approval; prefer the file tools for reading and editing files.
Example
Run for real by scripts/tool-examples.py in a small demo project, with Haiku 5.5 where the tool calls a model. The output is exactly what the tool returned, in 0.3s.
The call
{
"tool": "bash",
"arguments": {
"command": "python -m pytest -q -p no:cacheprovider 2>&1 | tail -2"
}
}Real output
exit_code: 0 stdout: . [100%] 1 passed in 0.01s
Parameters
| Name | Type | Description |
|---|---|---|
| command* | string | The shell command to run, e.g. `pytest -q`. Never a placeholder such as `:` or `true`: to plan or explain, write text instead. |
| timeout | number | Seconds to wait before moving the command to the background (default 120, max 600) |
| working_directory | string | Optional relative working directory under the project root |
| background | boolean | Run the command detached, write logs to a file, and return immediately. Use for dev servers, watchers, and other commands that don't exit. Common long-running commands (npm run dev, next dev, vite, uvicorn, etc.) are auto-detected and backgrounded even if this flag isn't set. |
* required
More in Files and code
Read, search and edit the project; run commands, code and git.