Built-in Tools
The core tools
| Tool | Purpose | Asks permission (Manual mode) |
|---|---|---|
Read | Read file contents | No (inside working dirs) |
Write | Create or overwrite a file | Yes |
Edit | Targeted exact-string replacement | Yes |
Bash | Run shell commands | Yes (a built-in read-only command set runs without prompting) |
Grep | Search file contents for a pattern | No |
Glob | Find files by name pattern | No |
Agent | Spawn a subagent | No |
WebFetch | Fetch a URL | Yes |
NotebookEdit | Edit Jupyter cells | Yes |
Tool names are the exact strings used in permission rules, subagent tools lists and hook matchers. Note: the tools reference lists Grep and Glob as absent by default on macOS, Linux and WSL (version-sensitive; check your build).
Edit semantics
- Exact string replacement with
old_stringandnew_string: no regex, no fuzzy matching. old_stringmust match the file exactly, including whitespace and indentation.old_stringmust appear exactly once. If it appears more than once, use a longer string with surrounding context to pin one occurrence, or setreplace_all: true.- A file that changed after Claude last read it can still be edited if
old_stringmatches current content exactly and unambiguously.
Design guidance for repeated Edit failures: re-read the file to get exact current text, or fall back to reading and rewriting the file with Write when edits are large.
Choosing between them (design guidance)
- Know the name pattern:
Glob. Know a string or symbol inside files:Grep. - Small precise change:
Edit. New file or total rewrite:Write. - Anything needing a shell (tests, git, builds):
Bash. - Broad exploration of a large codebase: delegate to a subagent so reads do not fill the main context.
Bash behaviour
- A
cdcarries over to later Bash calls while it stays inside the project or an added working directory; subagent sessions never carry over directory changes. - Default timeout is two minutes, ceiling ten minutes. A foreground command that reaches its timeout is moved to the background, not killed (unless it starts with
sleep). - Long output is saved to a file with a preview; Claude reads the file when needed.
@ references
@path includes the file's content when it fits the Read limit (25,000 tokens by default; text files over 256 KB are not included). A directory reference shows a listing, not contents. @ file references also add the CLAUDE.md of that file's directory and parents.
Exam traps
- Using
Grepto find files by name, orGlobto search inside files. - Edit with a non-unique
old_stringand expecting it to pick one. - Expecting regex in Edit.
- Assuming a subagent keeps the main session's working directory change.
References
- Tools reference — checked Oct 16, 2026
- Common workflows — checked Oct 16, 2026
Check your understanding
Find every file named
*.test.ts. Tool?Show answerHide answerAnswer
Glob.Edit fails: "string appears more than once". Two fixes?Show answerHide answer
Answer
Add surrounding context to make it unique, orreplace_all: true.A build command exceeds its timeout. What happens?Show answerHide answer
Answer
It moves to the background; it is not killed.