Tools · Files and code

bash

Changes things

Run 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 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

NameTypeDescription
command*stringThe shell command to run, e.g. `pytest -q`. Never a placeholder such as `:` or `true`: to plan or explain, write text instead.
timeoutnumberSeconds to wait before moving the command to the background (default 120, max 600)
working_directorystringOptional relative working directory under the project root
backgroundbooleanRun 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

Read, search and edit the project; run commands, code and git.