Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.0.50 Home All releases olderv2.0.49 v2.0.51newer
Claude Code v2.0.50

JSON Schema Support in SDK Initialization

What: Pass JSON schemas at SDK initialization time for automatic structured output validation. How to use:

# Python SDK example
from claude_code import ClaudeCode

client = ClaudeCode()
response = client.run(
    prompt="Generate user data",
    json_schema={
        "type": "object",
        "properties": {
            "name": {"type": "string"},
            "age": {"type": "integer"}
        },
        "required": ["name", "age"]
    }
)

Details:

  • Schema is validated using Ajv validator
  • Automatically creates a StructuredOutput validation tool
  • Validates all outputs against the schema throughout the session
  • Works via both SDK initialization and CLI --json-schema flag
  • Evidence: $D0() at line 2327, $G1() at line 470974 in v2.0.50

See this entry in the whole of v2.0.50 →