AI Development

How Does Claude Code with Opus 5.5 Read Files, Call Tools, and Return JSON? 2026 strict Tools and Structured Output

About 14 min read

Around November 2026, Structured Outputs GA on Opus 5.5, and Claude Code gained a stronger Plan Mode (editable plan.md) on the same model. The engineering split is unchanged: reads are tool_use JSON, repo changes are host-executed, UI/CI summaries use output_config.format—do not merge the three into one markdown blob.

Before you read

Phase Claude Code / API Host JSON
Read repo Read / Glob / Grep tool_use.input file_path, offset/limit audit
Edit & run Edit / Write / Bash; strict params gates, cwd, allowed roots
Structured delivery output_config.format json_schema deliverable_schema, risk, next_tool
Plan Mode Human-editable plan.md, then execute plan_path, turn, plan_mode
Long jobs Still Messages + tool loop See Compaction post—not here

Facts through 2026-11-05: Anthropic Structured Outputs / strict tool use, Claude Code Plan Mode with Opus 5.5. Paths and toolu_read_01 are fictional.

Read first, strict tools next, json_schema for deliverables

A typical Claude Code loop on Opus 5.5 breaks into three JSON contracts:

  • Observe: the model emits Read / Grep tool_use; the host returns slices or hits in tool_result—not pretend reads.
  • Execute: for replay harnesses, set strict: true on tools so input must match input_schema; Claude Code wraps the same shapes in-product.
  • Deliver: dashboards, PR templates, or CI gates use output_config.format.type: json_schema, separate from tool args—Structured Output is what Claude says; strict is how functions are called.

Product intro: Coding Agent intro. Opus 5.5 Messages and effort: Opus 5.5 tool JSON. Compaction and checklist state: long-task state—this post only adds read + structured delivery practice.

Read block, strict tools, Structured Output, host turn

1. Read tool_use. Still content blocks on Opus 5.5; Claude Code’s usual first hop:

{
  "type": "tool_use",
  "id": "toolu_read_01",
  "name": "Read",
  "input": {
    "file_path": "src/orders/lookup.ts",
    "offset": 1,
    "limit": 120
  }
}

2. tool_result write-back. Host adds line numbers and truncates; the model only sees this string next:

{
  "type": "tool_result",
  "tool_use_id": "toolu_read_01",
  "content": "     1|export function lookupOrder(id: string) {\n     2|  // TODO: validate A-1042 pattern\n     3|  return fetch(`/api/orders/${id}`);\n     4|}"
}

3. strict tool table (Messages). Mirror Claude Code for offline replay or compliance:

{
  "model": "claude-opus-5-5",
  "max_tokens": 8192,
  "tools": [
    {
      "name": "Read",
      "description": "Read a slice of a file. Paths must stay under the workspace root.",
      "strict": true,
      "input_schema": {
        "type": "object",
        "properties": {
          "file_path": { "type": "string" },
          "offset": { "type": "integer", "minimum": 1 },
          "limit": { "type": "integer", "minimum": 1, "maximum": 500 }
        },
        "required": ["file_path"],
        "additionalProperties": false
      }
    },
    {
      "name": "Grep",
      "description": "Search the repo with ripgrep.",
      "strict": true,
      "input_schema": {
        "type": "object",
        "properties": {
          "pattern": { "type": "string" },
          "path": { "type": "string" },
          "glob": { "type": "string" }
        },
        "required": ["pattern"],
        "additionalProperties": false
      }
    }
  ],
  "messages": [{
    "role": "user",
    "content": "Find where order A-1042 is validated before calling lookup."
  }]
}

4. Structured deliverable. Same or next request; fields for UI/gates:

{
  "model": "claude-opus-5-5",
  "max_tokens": 4096,
  "tools": [{ "name": "Read", "strict": true, "input_schema": { "type": "object", "properties": { "file_path": { "type": "string" } }, "required": ["file_path"], "additionalProperties": false } }],
  "output_config": {
    "format": {
      "type": "json_schema",
      "schema": {
        "type": "object",
        "properties": {
          "order_id": { "type": "string", "pattern": "^[A-Z]-\\d{4}$" },
          "files_touched": { "type": "array", "items": { "type": "string" } },
          "risk": { "type": "string", "enum": ["low", "medium", "high"] },
          "next_tool": { "type": "string", "enum": ["Read", "Edit", "Bash", "none"] }
        },
        "required": ["order_id", "files_touched", "risk", "next_tool"],
        "additionalProperties": false
      }
    }
  },
  "messages": []
}

5. Host turn (illustrative). Plan Mode and deliverable version in state for session diff:

{
  "session_id": "cc_sess_demo_01",
  "model": "claude-opus-5-5",
  "plan_mode": true,
  "plan_path": ".claude/plan.md",
  "turn": 3,
  "last_blocks": ["tool_use:Read", "tool_result", "tool_use:Grep"],
  "deliverable_schema": "task_summary_v1",
  "awaiting": "tool_result"
}

Three JSON roles

Separating chat markdown from machine objects makes review easier:

Object Producer Typical fields
tool_use / tool_result Model proposes, host runs name, input, tool_use_id
strict input_schema API constrained sampling additionalProperties: false
output_config.format Final text block order_id, risk, next_tool
plan.md Plan Mode human edit Step list—not tool args

Bash / Edit go through permission gates; Read is looser but should stay within workspace roots. See permissions.

Five steps with fictional order A-1042

Walk through in staging before a production repo:

  1. Read + Grep only first. Locate validation logic; no Bash on step one.
  2. Log tool_use / tool_result. Align ids; store last_blocks in state.
  3. Open Edit only when needed. Paths must stay on allowlist.
  4. Deliver with json_schema. risk / next_tool for human or CI—never copy secrets from tool_result.
  5. Plan Mode: plan.md first. Human edits steps, then auto; keep plan_path in state for diff.

All five on JSON objects—otherwise Claude Code sessions are not replayable.

Review traces, not prose

Opus 5.5 Structured Output cuts parse errors; it does not replace permission review:

  • format messages; Schema validation strict and deliverable schemas.
  • JSONPath for paths like $.content[?(@.type=='tool_use')].input.file_path.
  • JSON Diff state around Plan Mode; ensure deliverable_schema is not dropped.
  • Structured order_id should match the tool chain (A-1042).
  • JSONSort runs locally in the browser—do not upload real repos or keys.

Deliverable JSON must validate on its own—that is structured output, not pretty printing.

Common mistakes

  • Treating Structured Output as tool args. format shapes reply text; Edit still uses tool_use.
  • Edit before Read. Opus 5.5 edits aggressively—hosts should enforce read-first.
  • strict on half the tool surface. Read strict but Edit loose breaks audits.
  • Mixing plan.md with deliverable schema. plan for humans; schema for programs.
  • Unbounded tool_result logs. Still a JSON string; format then truncate display fields.
  • Rewriting Coding Agent 101. See the intro post; this is Opus 5.5 read/tools/structured only.

FAQ

Do I need strict on Claude Code built-in tools?

The terminal product wraps execution and confirmations. For offline replay, compliance, or custom harnesses, mirror input_schema on Messages and enable strict.

Structured Output and strict tools in one request?

Yes. Anthropic documents them as complementary: tool params vs final json_schema reply.

Is plan.md JSON?

No—it is Markdown. Machine-readable progress still belongs in deliverable schema or host state JSON.

How large should Read limit be?

Host policy. The sample caps at 500 lines to avoid huge tool_result; paginate large files.

How does this relate to Gemini structured-output news?

Same “schema-constrained sampling” headline; Claude Code stays on Messages + strict + output_config. Cross-vendor fields: Opus vs Astra post—not here.

Conclusion

With Claude Code on Opus 5.5, reads are tool_use JSON, safe edits need permissions + strict tools, and system-facing conclusions use output_config.format. Plan Mode keeps plans human; Structured Output keeps deliverables schema-bound.

The model only fills JSON; disk, shells, and schema validation stay with the host. Make A-1042 replayable before full auto.

Further reading

Changelog: First published