Structured Output
structuredGenerate JSON output that conforms to a provided JSON Schema, enabling validated data extraction, classification, and entity parsing from text or files with machine-parseable results.
Instructions
Generate JSON conforming to a provided JSON Schema. Uses Claude CLI's native --json-schema flag for validated output (not client-side validation).
Use for: data extraction from text/files, classification, entity parsing, or any task needing machine-parseable output.
Cost: Similar to query (~$0.01-0.10/call). Schema complexity doesn't significantly affect cost.
Tips:
Pass the JSON Schema as a JSON string in the schema parameter.
Schema max size: 20KB. Keep schemas focused for reliable output.
For extraction tasks, include source text via the files parameter or inline in the prompt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | No | Text file paths to include as context | |
| model | No | Model alias or full Claude model name | |
| prompt | Yes | What to generate or extract | |
| schema | Yes | JSON Schema as a JSON string | |
| timeout | No | Timeout in milliseconds (default: 60000) | |
| sessionId | No | Claude session ID to resume with --resume | |
| maxBudgetUsd | No | Maximum cost budget in USD for this call (passed to --max-budget-usd) | |
| workingDirectory | No | Working directory for file resolution and CLI execution | |
| noSessionPersistence | No | Disable session persistence for ephemeral print calls |