Claude Certified Architect – Foundations Practice Question 7: Forced Tool Extraction

Claude Certified Architect, Foundations · Test 1 · question 7 of 10

Prompt Engineering & Structured Outputmedium

A pipeline extracts invoice fields from emails. The downstream parser needs a JSON object that always matches a fixed schema (vendor, total, currency, due_date), and Claude must never answer with free text instead. The team defines one tool named record_invoice whose input_schema is the extraction schema. On a model that supports forced tool use, which request setting makes the output reliably schema-shaped?

Select one answer
Show answer and explanation

Answer:

  • B. tool_choice {"type": "tool", "name": "record_invoice"}, then read the tool_use input

B is correct. Setting tool_choice to {"type": "tool", "name": "record_invoice"} forces Claude to call that specific tool, so the response contains a tool_use block whose input follows your input_schema. You parse that input instead of free text. (Adding strict tool use makes schema conformance guaranteed rather than just highly likely.) Forced tool use (any or tool) is rejected with manual extended thinking and returns a 400 on Claude Opus 5.5, Sonnet 5.5, Fable 5.1 and Mythos 5.1; on those models use auto with strict tool use, or structured outputs.

A is wrong because "auto" lets Claude choose to answer in prose, which is exactly the failure to avoid. C is wrong because "any" forces some tool call but lets Claude pick among tools, and overlapping tools make the output shape unpredictable. D is wrong because "none" prevents tool calls entirely, leaving only free text with no schema enforcement.

Reference: Define tools - Claude Platform Docs

Practice Test 1 ›

Study guides for Claude Certified Architect, Foundations