CCA Prep Studio
—

Task 4.3 · Domain 4: Prompt Engineering & Structured Output

Structured output with tool use

The most reliable way to get structured output is to define a tool whose input schema is the shape you want and read the tool_use call as the result. That guarantees the structure and removes JSON syntax errors, but it says nothing about whether the values are right. Schema design, especially nullable fields and extensible enums, decides whether the model reports honestly or invents values.

Updated 10-20-2026 · Official guide §6, Task 4.3

Key points

  • Tool use with a JSON schema is the most reliable path to schema-compliant output and eliminates syntax errors.
  • tool_choice auto lets Claude reply in text; any forces some tool call; a forced choice names the tool that must be called.
  • Strict schemas prevent syntax errors but not semantic errors such as totals that do not add up or values in the wrong field.
  • Required versus optional fields: a required field pushes the model to fabricate when the source lacks the value.
  • Enums with "other" plus a detail string extend gracefully; an "unclear" value handles ambiguous cases.
  • Format normalization rules belong in the prompt alongside the schema when source formatting varies.

Skills the exam expects

  • Define an extraction tool and read structured data from the tool_use response.
  • Use tool_choice any when several extraction schemas exist and the document type is unknown.
  • Force a specific tool so a particular extraction runs before enrichment steps.
  • Make fields optional or nullable when documents may not contain them.
  • Add "unclear" and "other" plus detail values for extensible categorization.

Common misconceptions

  • "Asking for JSON in the prompt is just as reliable." Prompted formatting is probabilistic; tool use is enforced.
  • "tool_choice auto guarantees a tool call." Only any or a forced choice does.
  • "If the schema validates, the data is correct." The schema checks shape, not meaning.

Watch for

  • Parsing free-text replies as JSON and patching failures with cleanup heuristics.
  • Required fields producing plausible but invented values.
  • Forcing new categories into the closest enum value instead of "other".

Practice task 4.3

57 practice items cover this task in CCA Prep Studio: flashcards, matching, scenario questions and explain-it-back exercises, each tracked toward your mastery score.

CCA Prep Studio is an independent study product. It is not made, endorsed or sponsored by Anthropic. Claude is a trademark of Anthropic, PBC, and is used here only to name the exam and the technology it covers. Content is written in our own words and cites the official exam guide; no exam questions are reproduced. © 2026 NovaLinQs AI, LLC.