CCAR-F scenarios › Developer Productivity with Claude · Question 34 of 60

Scenario 4 · Developer Productivity with Claude

Your team is building internal developer tools on the Claude Agent SDK. The agent helps engineers find their way around unfamiliar or legacy codebases, generates boilerplate, and automates repetitive chores. It works through the built-in Read, Write, Bash, Grep, and Glob tools, plus connections to Model Context Protocol (MCP) servers.

Tool Design & MCP Integration

The agent generates a service class from a template and then needs to change one of several identical `return null;` lines inside it. Logs show the Edit tool failing repeatedly because the anchor text is not unique, and the agent retrying the same Edit with the same text until the session times out. Which fallback should the agent be guided to use?

Show answer and explanation

Answer: A — Use Read to load the full file, apply the change to the right occurrence, and use Write to save the complete updated contents back.

Edit works by matching unique text. When the anchor isn't unique, section 6 names Read followed by Write as the reliable fallback. (b) changes occurrences that weren't meant to change. (c) is an arbitrary cap that gives up instead of fixing the cause. (d) checks the path, but the error is about a non-unique match, not a missing file.