Lesson 9 · Domain 2 — Tool Design & MCP Integration (18% of exam)
Last Domain 2 lesson. Three task statements, one theme: an agent — or a whole team — with unrestricted access to everything makes worse decisions than one with a small, well-scoped set of options.
Giving an agent 18 tools instead of 4–5 doesn't make it more capable — it degrades tool selection reliability by increasing decision complexity at every turn. Worse: agents given tools outside their actual specialization tend to misuse them. A synthesis subagent with web-search access will occasionally go searching instead of synthesizing, even though a dedicated search subagent already exists for exactly that. The fix is scoping: restrict each subagent's tools to what its role actually needs, with narrow, deliberate exceptions for genuinely high-frequency cross-role needs (a scoped verify_fact tool for a synthesis agent, say) rather than open access.
// "auto" (the default) — the model may call a tool, or just respond in text
const auto = await client.messages.create({
model: "claude-sonnet-5", messages, tools, tool_choice: { type: "auto" },
});
// "any" — the model MUST call some tool, but picks which one
const forcedAny = await client.messages.create({
model: "claude-sonnet-5", messages, tools, tool_choice: { type: "any" },
});
// forced — a specific named tool runs first, guaranteed
const forcedNamed = await client.messages.create({
model: "claude-sonnet-5", messages, tools,
tool_choice: { type: "tool", name: "extract_metadata" },
});
Forced selection is how you guarantee ordering — e.g. an extraction tool must run before any enrichment tool touches its output, in every case, with no dependence on the model choosing to call it first.
.mcp.json — project-scoped, checked into version control, shared team tooling. Supports environment-variable expansion (${GITHUB_TOKEN}) so credentials never get committed alongside the config.~/.claude.json — user-scoped, personal or experimental servers.Every tool from every connected server becomes available to the agent simultaneously at connection time — which is exactly why the "fewer tools, scoped by role" principle above matters at the server level too, not just within a single agent's own tool list. And prefer an existing community MCP server for standard integrations (Jira, GitHub) over building one from scratch — reserve custom servers for genuinely team-specific workflows. MCP resources — exposing a catalog (issue summaries, a documentation hierarchy, a database schema) directly — cut down on exploratory tool calls the agent would otherwise need just to figure out what's available.
Primary source: the Model Context Protocol docs cover server scoping and resources; Anthropic's Claude API docs cover tool_choice — this lesson closes Domain 2, compressing Task Statements 2.3, 2.4, and 2.5.
That's Domain 2 wrapped up alongside Domain 3. Ready to move into Domain 4, prompt engineering and structured output? Just say the word.