By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A team shipped an MCP server with one tool called search_codebase. It shells out to a hand-written script, returns four hundred kilobytes of text, and times out on the monorepo. The same agent already had Grep and Glob, and nobody had noticed.
This is a common shape of waste. The built-in tools are already in the runtime, already permissioned, and already understood by the model. Rebuilding them as custom tools adds a schema to learn and a process to fail.
The exam names six built-in tools: Read, Write, Edit, Bash, Grep and Glob. Learn what each one is for and which one carries the risk.
The efficient sequence is Glob, then Grep, then Read, then Edit. Narrow the file set, find the exact lines, read only what you need, and change one precise string.
| Tool | What it does | Use it when | Risk |
|---|---|---|---|
| Read | Returns a file's contents with line numbers, with an offset and limit for large files | You know the path and need the text | Low, but it costs context |
| Glob | Finds files by path pattern, most recently modified first | You know a name or a shape, not the folder | Low |
| Grep | Searches file contents by regular expression | You know a symbol or string, not the file | Low |
| Edit | Replaces one exact string in a file | You are changing a known, unique span | Medium: a wrong match edits the wrong code |
| Write | Creates a file or replaces its whole contents | You are creating a new file | Medium: an overwrite loses work |
| Bash | Runs a shell command | Nothing above can do the job | High: the whole machine |
Prefer these over custom tools for codebase work. They are permissioned by the runtime, their output shape is stable, and every call appears in the transcript in a form a reviewer can read. A custom read_file tool buys you nothing and costs you a schema.
The cheap path through a large repository is always the same: narrow, then search, then read. Start wide with Glob, cut down with Grep, and open only the files that matched.
Glob the pattern, for example **/*order*.py, to get a short list of candidate paths.
Grep the symbol inside that list, for example the function name, to get file and line matches.
Read the matched region with an offset and limit instead of the whole file.
Edit one exact span, or Write a new file when nothing existed.
This order keeps the context window small, which matters more than it sounds. A thousand lines of unrelated code in the transcript pushes out the instruction you actually needed.
Edit replaces one exact string with another. It fails when the string is missing, and it fails when the string appears more than once, because it cannot tell which copy you meant. Include enough surrounding text to make the match unique.
Write creates a file or replaces its contents. In Claude Code, an overwrite of a file the session has not read is refused, which protects you from a blind replacement. Treat that rule as a feature and read before you write.
Two editing rules pay for themselves. Change the smallest span that expresses the intent, and never mix a rename with a logic change in one edit. A reviewer can read either one alone; a combined edit hides the behaviour change inside the mechanical one.
A narrow read is also cheaper to review. The transcript shows the evidence the answer rests on, rather than the whole file the model happened to open.
Bash runs a shell command with the permissions of the user who started the session. It can read any file, delete any directory, call any network endpoint and change any branch. Every other built-in tool is a narrower question asked of the same machine.
Scope each command instead of trusting the model to be careful. Name the paths, prefer a dry run, and keep destructive defaults out of reach.
{
"permissions": {
"allow": [
"Bash(git status:*)",
"Bash(git diff:*)",
"Bash(pytest:*)"
],
"deny": [
"Bash(git push --force:*)",
"Bash(git reset --hard:*)",
"Bash(rm -rf:*)"
]
}
}Key takeaways
Read, Write, Edit, Bash, Grep and Glob are already permissioned and understood, so prefer them for codebase work.
Narrow with Glob, search with Grep, then Read only the matching range.
Edit needs an exact and unique match; Write replaces a whole file and is wrong for a one line change.
Bash is the highest-risk tool because it reaches the whole machine: scope commands and deny destructive shapes.
Choose the least powerful tool that answers the question, and reach for Bash last.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.