CCAR-F · Tool Design & MCP
Read, Write, Edit, Bash, Grep and Glob: which one for what
Claude Code and the Agent SDK come with built-in tools for working with files and commands. The exam doesn’t ask about their parameter names, but about which one to pick in each situation and how to combine them.
What each one does
| Tool | What for | Example |
|---|---|---|
| Grep | Content search: what the file says | Who calls processLegacyOrder, where an error message appears, a key matching AKIA[0-9A-Z]{16} |
| Glob | File path pattern matching: what the file is called | Every test with **/*.test.tsx |
| Read | Read a whole file | Open the file that registers a route |
| Edit | Targeted change replacing a unique text | const PORT = 3000; to const PORT = 8080; |
| Write | Write a whole file | Create a file or rewrite it after reading it |
| Bash | Run commands | Run the tests or the build |
The short rule: Grep is what it says; Glob is what it’s called. Searching for tests with Grep returns any file that mentions “test”; searching for a function’s callers with Glob only finds files with that name.
Edit and its plan B
Edit needs unique anchor text: it replaces a fragment that appears only once. If timeout: 30 appears in three sections and only the payments one must change, Edit fails. The plan B the exam guide names is Read + Write: load the whole file, change only what’s needed and write it back in full. In practice you can also widen the text with more context, but in the exam the answer is Read + Write.
The reverse is a trap too: if the text is unique, Edit is the right call. Rewriting 900 lines to change one risks accidental changes.
Exploring without reading everything
To understand a 47-file module, reading them all first fills the context with irrelevant code. Incremental exploration starts from an anchor:
- Grep for something concrete: a route string (
/api/v2/invoices), a class name, an error message. - Read the file that comes up.
- Follow the imports and the flow, reading only what you need as you go.
Finding every usage
A single Grep for the original name isn’t enough when there are re-exports under another name or import aliases. If a “barrel” file exports processOrder as submitOrder, consumers that import submitOrder never contain the text processOrder. The search takes several steps:
- Grep for the definition and its re-exports.
- Read those files to collect every exported name (
fmtMoney,fc). - A new Grep for each name.
The usual traps
- Grep to find files by name, or Glob to search content.
- Reading the whole repository “for context”: the main anti-pattern.
sedorreplace_allwhen Edit fails on repeated text: they change every occurrence, including the ones that had to stay.- Modifying the file to make the text unique, or restructuring code to dodge a tool limitation.
findorgrepthrough Bash: they work, but the exam expects the built-in tool made for the job.- Writing from memory with Write without reading first: it destroys the rest of the file.
In the exam
Identify what’s being searched for: text inside files, or a naming pattern? A change with a unique or a repeated anchor? Are there aliases or re-exports in the scenario? Those three questions give you the tool sequence.
Quick question
A practice exam question on this domain. It counts towards your progress.
A financial analysis firm uses a research coordinator that delegates source gathering to subagents. For a report on renewable-energy financing, it sends a subagent a brief listing 8 sources.
The subagent returns findings from 6 of the 8 sources plus two structured errors. Source 7: errorCategory "transient", isRetryable: true (rate limited). Source 8: errorCategory "permission", isRetryable: false (subscription required). The six successful sources are relevant and of good quality.
The report is due to a client at the end of the week, and the firm's procurement team handles requests for new data subscriptions.
What should the coordinator do?