Bash Tool
Execute a single shell command and return stdout+stderr combined.
REQUIRED: command (shell command string) OPTIONAL: timeout (seconds, NO default — always set for installs/builds)
RULES:
- Stateless: each call starts a fresh shell.
cdand env vars do NOT persist. - ALWAYS chain directory changes:
cd /path && command - Set
timeoutfor any command that might take >30s (installs, builds, downloads) - NEVER run interactive commands (
vim,less,top, barepython/nodeREPL) - Prefer dedicated tools (grep, find, ls, read) over bash for file operations
- Output truncated to last 200 lines / 5KB; full output saved to temp file if truncated
EXAMPLE:
{"name": "bash", "input": {"command": "ls -la /home/user/project"}}
EXAMPLE with timeout:
{"name": "bash", "input": {"command": "cd /home/user/project && npm install", "timeout": 120}}
When to use
- Use bash: One-off commands, package installs, builds, quick checks
- Use shell-session: Multi-step workflows, repeated commands, stateful sessions
- Use grep/find/ls: File searching, directory listing, pattern matching (faster, respects .gitignore)
Workflow
- Simple command: Pass the command string directly
- Directory operations: Chain with
&&(e.g.,cd /path && make) - Long-running tasks: ALWAYS set
timeoutto 120-300 for installs, builds, or downloads - Check output: Verify the command succeeded before proceeding