BrainyBeeBrainyBee
ExploreBlogStart Studying
HomeClaude Certified Architect - Foundations (CCAR-F)Domain 2 Project — build tools your agent actually picks correctly
Hands-on Lab919 words

Domain 2 Project — build tools your agent actually picks correctly

Claude Certified Architect - Foundations (CCAR-F) › Domain 2: Tool Design & MCP Integration

Domain 2 Project — build tools your agent actually picks correctly

This project opens by breaking something. You will write two tools the way people actually write them, measure how often the model picks the wrong one, and then fix it with nothing but better English — and watch the number move.

Everything after that is a repair on the same system: errors an agent can act on, tools scoped to roles, an MCP server wired into Claude Code, and the built-ins used to trace it all. Five stages, one per task statement.

Domain 2 is 18% of the exam and rests on a single premise: the description is the interface. Stage 1 is where you stop taking that on trust.

The project at a glance

Domain
2 · Tool Design & MCP Integration (18%)
Stages
5, one per task statement
Difficulty
Intermediate
Total time
175 minutes
You need
Python 3.10+, the anthropic SDK, an API key, Claude Code
Based on
Exam guide Preparation Exercises 1 and 2

What you will be able to do

  • Write a tool description that a model can select on, and name the four things a thin one leaves out
  • Return structured errors an agent can branch on, and distinguish a failed call from a successful one that matched nothing
  • Scope tools across agent roles and choose between the three tool_choice settings from what the failure would be
  • Configure an MCP server at the right scope with credentials that never enter version control
  • Select the correct built-in for a search, and recover when Edit cannot find a unique anchor

Before you start

You need the Domain 1 setup plus Claude Code. If you have not done that project, the four commands are:

bash
mkdir ccarf-domain-2 && cd ccarf-domain-2 python3 -m venv .venv && source .venv/bin/activate pip install anthropic export ANTHROPIC_API_KEY=your-key-here

Stages 2.4 and 2.5 need Claude Code itself — check it responds before you get there, because an MCP server that will not load and a CLI that is not installed look identical from the outside.

Stage 2.1 also needs a measurement harness, and it is worth building properly because three later stages re-use it: a list of twenty ambiguous requests, a loop that sends each one, and a counter of which tool came back. Twenty is enough to see a rate and small enough to re-run without thinking about the bill.

Build it in this order

The order is not the guide's. Stage 1 is a measurement and stages 2 to 5 are repairs, so every later claim can be checked against a number you produced yourself rather than against a sentence you read.

Five stages

  1. 1

    2.1 · Break tool selection, then fix it · 35 min

    BUILD — Two deliberately confusable tools — analyze_content and analyze_document, with the vague descriptions people actually write — and a script that sends twenty ambiguous requests and counts which tool got picked. Then rewrite both descriptions with purpose, inputs, outputs, examples, edge cases and boundaries, and re-run the same twenty. WHY — Domain 2 rests on one premise: the description IS the interface, because it is the primary signal the model selects on. A measured misroute rate before and after makes that premise yours rather than something you read. YOU SHOULD SEE — A misroute rate that is embarrassing before and near zero after, from a change that touched no code — only two paragraphs of English. TRAP — Fixing it in the system prompt instead. It will appear to work, and it will keep working until a keyword in that prompt collides with a third tool six weeks later. The exam tests this exact substitution in both directions. STUCK? — If the rate does not move, read your two new descriptions side by side and ask which sentence in one would stop you picking the other. If there is not one, you rewrote the prose without adding the distinction.

Stage 1 in full

Write the bad version first

This feels wrong and it is the point. Two tools, described the way a hurried engineer describes them:

python
BAD_TOOLS = [ { "name": "analyze_content", "description": "Analyzes content and returns insights.", "input_schema": { "type": "object", "properties": {"input": {"type": "string"}}, "required": ["input"], }, }, { "name": "analyze_document", "description": "Analyzes a document and returns analysis.", "input_schema": { "type": "object", "properties": {"input": {"type": "string"}}, "required": ["input"], }, }, ]

Neither description is wrong. Neither is usable. A model choosing between them has nothing to choose on, and the exam's phrase for the result is misrouting.

Measure it

Twenty requests that could plausibly go to either, sent with tool_choice set to any so the model must pick one:

python
REQUESTS = [ "Pull the key points out of this web page.", "Summarise the attached PDF.", "What does this article say about pricing?", # ... seventeen more, deliberately ambiguous ] def measure(tools): picks = {} for request in REQUESTS: response = client.messages.create( model="claude-opus-5", max_tokens=1024, tools=tools, tool_choice={"type": "any"}, messages=[{"role": "user", "content": request}], ) for block in response.content: if block.type == "tool_use": picks[block.name] = picks.get(block.name, 0) + 1 return picks print("before:", measure(BAD_TOOLS))

Write down the number. It is the only baseline you get.

Read the tool count and the description length

When a Domain 2 stem describes unreliable selection, two details in it are usually load-bearing: how many tools the agent holds, and how the descriptions are characterised. Eighteen tools where four would do, or descriptions called brief or minimal, are the defect the question is about — not background colour.

Now fix it with English

Four things go into each description: what it is FOR, what it expects, what it returns, and when to use it INSTEAD of the other one. That last clause is the one that does the work.

python
GOOD_TOOLS = [ { "name": "extract_web_results", "description": ( "Extract structured findings from a WEB PAGE fetched by URL. " "Input: a http or https URL. Returns: title, publication date, and a list " "of claims with the sentence each came from. " "Use this for anything addressed by URL. " "Do NOT use it for an uploaded file — use extract_document_data for that." ), "input_schema": { "type": "object", "properties": {"url": {"type": "string", "description": "http or https URL"}}, "required": ["url"], }, }, { "name": "extract_document_data", "description": ( "Extract structured findings from an UPLOADED DOCUMENT (PDF, DOCX, TXT). " "Input: a document id from the files store. Returns: title, author, page " "count, and a list of claims with the page each came from. " "Use this for anything the user has uploaded. " "Do NOT use it for a URL — use extract_web_results for that." ), "input_schema": { "type": "object", "properties": {"document_id": {"type": "string"}}, "required": ["document_id"], }, }, ] print("after:", measure(GOOD_TOOLS))

Three changes carried the improvement, and it is worth knowing which. The names stopped overlapping. The input schemas became different types, so the request itself often decides. And each description names the other tool and says when to prefer it — the sentence a thin description never has.

Multiple choice · Medium

Two tools, analyze_content and analyze_document, have near-identical descriptions and the agent routes requests to the wrong one roughly half the time. Which change addresses the cause?

Prove stage 1 before moving on

  • Your before and after numbers are on the same twenty requests. If you changed the request list too, you measured nothing.
  • Read the two new descriptions and find, in each, the sentence that would stop you picking the other. If it is not there, the rate will not have moved.
  • Keep the harness. Stage 2.3 re-runs it against eighteen tools, and the comparison is the point.

When you get stuck

Every stage above ends with a STUCK? line — the first thing worth checking, which is usually the thing actually wrong.

Past that, in the app: the Help button in this page's toolbar sends the tutor the section you are currently reading, together with the project's title, so you can ask "why does this not work" without pasting anything in. It knows which stage you are on.

  • Measure before you fix. Every claim in this domain is about a rate, and a rate you did not take before the change is a rate you cannot argue about after it.
  • Read the tool call, not the reply. Which tool was chosen, and with what arguments, is the observable this domain turns on — the prose the model wraps around it is not.
  • Change the description before the prompt. If a selection problem is fixed in the system prompt, it will come back the next time a keyword collides.

Where the depth lives

This page is for building. The reading is elsewhere, and repeating it here would put the same claims in three places to drift apart:

  • The Domain 2 roadmap — what the domain is about, the order to learn it in, and where it catches people
  • 5 flashcard decks, 43 cards — one card per published objective
  • 46 Domain 2 questions — judgement under exam conditions, inside the six production scenarios

Nobody has run this yet

The code and commands here were written against the documented behaviour and checked against the reference — but no stage has been executed end to end. If something does not behave as described, trust what your terminal says over what this page does, and please report it. The row carries a needs_human_run_through stamp so this page can be found again once someone has worked it through.

Sources

  • CCAR-F Exam Guide v1.0, section 6 — Domain 2's five task statements, which are this project's five stages.
  • CCAR-F Exam Guide v1.0, section 8 — Preparation Exercise 1 (tool descriptions and structured error responses) and Exercise 2 (MCP server configuration with environment variable expansion).
  • Anthropic Messages API reference — the tool definition shape, the three tool_choice settings, and the parallel-tool-use rule.
  • Model Context Protocol documentation — server scoping, resources, and the isError response shape.

What is quoted, and what is argued

The task statements and the exercise skeletons are the exam guide's. Product behaviour is documented behaviour, checked against the reference rather than restated from memory. The stage ordering, the traps and the teaching are this hive's reading of that material — useful preparation, not an official statement about what the exam contains.

All Claude Certified Architect - Foundations (CCAR-F) Study Resources

Related Notes

  • Domain 2: Tool Design & MCP Integration157 words
  • CCAR-F: how the exam is dealt194 words
  • Scenario 1: Customer Support Resolution Agent225 words
  • Scenario 2: Code Generation with Claude Code185 words
  • Scenario 3: Multi-Agent Research System199 words
  • Scenario 4: Developer Productivity with Claude197 words
  • Scenario 5: Claude Code for Continuous Integration168 words
  • Scenario 6: Structured Data Extraction185 words
  • Domain 1: Agentic Architecture & Orchestration169 words
  • Domain 1 Project — build a support agent, then make it a team1,191 words
  • Domain 3: Claude Code Configuration & Workflows150 words
  • Domain 3 Project — configure Claude Code for a team, then put it in CI881 words

Ready to study Claude Certified Architect - Foundations (CCAR-F)?

Practice tests, flashcards, and all study notes — free, no sign-up.

Start Studying

Ready to study Claude Certified Architect - Foundations (CCAR-F)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free
Claude Certified Architect - Foundations (CCAR-F) ResourcesExplore All HivesBlogHome

© 2026 BrainyBee. Free AI-powered exam prep.