Prompt Engineering & Structured Output20% of the exam

Structured output with tool use and JSON schemas

How strict tool use and JSON outputs (output_config.format) guarantee schema-valid structure but not correct values, how to read tool_use input, and how to design extraction schemas with required, nullable, "other" and "unclear" fields plus prompt normalization rules.

Official exam objective
Enforce structured output using tool use and JSON schemas

~7 min read · 13 practice questions ·

What the exam expects

  • Replace "respond only with JSON" prompting with an extraction tool whose input_schema describes the record, strict: true, and code that reads the tool_use block's input.
  • Choose between strict tool use and JSON outputs via output_config.format (not the deprecated output_format), and know that both guarantee schema-valid syntax but not semantically correct values.
  • Pick the structured-output route for an extraction call, including when tool_choice must guarantee that a tool is called.
  • Design schemas: required vs optional, nullable fields so Claude need not fabricate, "other" plus a detail string and "unclear" enum values, and no unsupported keywords such as minimum under strict mode.
  • Put format normalization rules in the prompt beside the schema, and detect max_tokens and refusal responses that may not match the schema.

Key terms: strict tool use (strict: true on a tool; grammar-constrained sampling keeps tool inputs schema-valid); JSON outputs (output_config.format with type: "json_schema", constraining Claude's reply text); constrained decoding (sampling restricted to schema-valid tokens); nullable field (a type array such as ["string", "null"]); semantic error (schema-valid output with wrong values).

Key facts

Strict tool use
Detail
strict: true constrains sampling so tool inputs match input_schema
tool_use.input
Detail
Already an object conforming to input_schema
JSON outputs
Detail
output_config.format, type: "json_schema"; result in the text block
output_format
Detail
Deprecated; 400 error without the beta header
Objects under strict
Detail
additionalProperties must be false
Unsupported keywords
Detail
minimum, maximum, multipleOf, minLength, maxLength: 400 error
Possible mismatch
Detail
stop_reason refusal or max_tokens
Complexity limits
Detail
20 strict tools, 24 optional parameters, 16 union-type parameters per request
Semantic errors
Detail
Not prevented by strict schemas
Sources for this section (4)
  • Why does a strict extraction tool remove json.loads() failures that "respond only with JSON" prompting cannot?
  • When should you use output_config.format instead of a strict tool?
  • Why make an extraction field nullable rather than required non-null?
  • Which two stop reasons mean a structured response might not match its schema?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the Claude Certified Architect - Foundations pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 30 lessons of the Claude Certified Architect - Foundations guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Inline practice questions and one-click topic practice (13 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the Claude Certified Architect - Foundations exam

Certifyforce is an independent study resource and is not affiliated with, endorsed by or sponsored by Anthropic. Claude is a trademark of Anthropic.