CCAR-F - Tool Design & MCP Integration - Section 2.5

Select and apply built-in tools (Read, Write, Edit, Bash, Grep, Glob) effectively.

Grep searches file contents for patterns such as function names, error strings or imports; Glob matches file paths by name or extension; Read and Write handle whole files while Edit makes targeted changes through unique text matching, falling back to Read plus Write when no unique anchor exists. Candidates should build codebase understanding incrementally, starting from Grep entry points and following imports with Read, rather than loading every file upfront.

Grep for content searchGlob for path patternsEdit unique text matchingRead plus Write fallbackincremental codebase exploration

Practice question for this objective

Free sampleTool Design & MCP Integrationeasy

The Northgate integrations team uses an agent to add a timeout field to a client module of roughly 2,000 lines in a legacy payments service. The agent reads part of the module, then calls the Write tool on that path with a payload containing the new field and the surrounding class. Afterwards the module on disk is 40 lines long and the rest of the original code is gone, although the tool call itself reported success. What does that tell the team about the Write tool?

  • AWrite replaces the entire contents of the target path with exactly the text supplied, so anything the agent did not include in that call is lost rather than merged with the existing file. Correct
  • BWrite appends its payload to the end of an existing file, so the original body is still present further down and the visible 40 lines are only the newest section of the module.
  • CWrite applies its payload as a patch relative to the last read of the file, so the missing body was dropped because the file on disk changed between that read and the write.
  • DWrite refuses a payload larger than a single call allows, so the tool kept the first 40 lines of what was supplied and quietly discarded the remainder of the module before saving.
Write overwrites a whole file with exactly the supplied text, so targeted changes to existing files belong to Edit rather than Write. Write has whole-file semantics: the path ends up holding precisely the payload and nothing more. A successful Write therefore confirms only that the supplied text was saved, not that the rest of the module was preserved, which is why a partial rewrite of a long file silently destroys the untouched code.

Why A is correct: Write is a whole-file operation, so its success signal means the supplied text was saved in full and nothing else survives; a targeted change to an existing file belongs to Edit instead.

Why B is wrong: Append is a familiar file operation and would explain a successful call, but the team can see that the earlier code is absent, so the payload clearly did not land after it.

Why C is wrong: Read-then-write races are a real hazard, which makes this plausible, but Write is not a patch operation and no concurrent change is needed to explain the loss.

Why D is wrong: Payload limits exist on some tools, so this reads as a reasonable failure mode, but the truncation here is of the original file rather than of the agent's payload.

See more CCAR-F practice questions, answers explained.

More in this domain

Back to all Tool Design & MCP Integration objectives, or the CCAR-F cert hub.

Examworthy is not affiliated with or endorsed by Anthropic. Original, blueprint-aligned practice material only.