Courseiva
Using the Claude API →mediumMultiple Choice

CCAO-F Using the Claude API Practice Question

A developer wants Claude to always reply in strict JSON matching a provided schema for an internal data-extraction pipeline. They consider the tool use feature as a way to constrain output. Which statement best describes how to use tool use to reliably obtain schema-conformant output?

⚠ Common exam trap

The trap here is expecting a dedicated JSON response format parameter, when structured output is obtained through tool definitions and the resulting tool_use block.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Define a tool whose input_schema describes the desired fields, then read the structured input from the tool_use block the model returns.

Tool use provides a structural contract: define a tool whose input_schema matches the target fields, and the model returns a tool_use block containing structured input. Reading that input gives schema-shaped data without parsing free text. This is the intended pattern for schema-constrained extraction in the Messages API.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Include the JSON schema in the system prompt and rely on the model to follow it without any tool definitions.

    Why it's wrong here

    Describing a schema in the system prompt is a soft instruction; the model may still add prose, omit fields, or vary formatting. It offers no structural guarantee and typically requires retries or post-processing. Tool use with an input_schema provides a stronger contract because the model's structured output is produced through the tool_use mechanism rather than free text.

  • ✗

    Set the response_format parameter to "json_schema" and supply the schema so the API validates the output before returning it.

    Why it's wrong here

    The Claude Messages API does not expose a response_format parameter of this kind. Schema-constrained output is achieved through tool definitions and tool_choice rather than a dedicated response format field. Relying on this invented parameter would leave output unconstrained, and the application would still need to validate or repair the model's text.

  • ✓

    Define a tool whose input_schema describes the desired fields, then read the structured input from the tool_use block the model returns.

    Why this is correct

    Defining a tool with an input_schema that mirrors the target structure, and optionally forcing selection with tool_choice, makes the model emit a tool_use block whose input conforms to that schema. Parsing that input yields structured data directly, which is a common and reliable pattern for schema-constrained extraction with the Messages API.

  • ✗

    Enable strict mode by setting the temperature parameter to 0, which forces valid JSON output.

    Why it's wrong here

    Temperature controls randomness, not output format. Even at 0 the model can emit explanations, markdown fences, or malformed JSON, so this does not guarantee schema conformance. Lower temperature may improve consistency but does not create a structural contract; tool use with an input_schema is the reliable approach for constrained output.

About these practice questions

Courseiva writes every CCAO-F question from scratch — 259 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Anthropic exam blueprint

This CCAO-F practice question is part of Courseiva's free Anthropic certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCAO-F exam.