structured
Generate JSON responses that conform to a provided JSON Schema. Use file context for data extraction, classification, or other machine-parseable tasks.
Instructions
Agentic structured output: generate a JSON response conforming to a provided JSON Schema. Gemini runs inside workingDirectory with read_file and grep tools, so it can read files for context. Use for data extraction, classification, or any task needing machine-parseable output. The response is validated against the schema; isError is true if validation fails.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>",
"schema": "<schema>"
},
"name": "structured"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | No | Text file paths to reference as context (no images). Gemini reads them with its own tools — contents are NOT inlined. Max 20 files, 1MB each. | |
| model | No | Gemini model override. Omit to let CLI auto-route. | |
| prompt | Yes | What to generate or extract from the provided context | |
| schema | Yes | JSON Schema as a string. The response will be validated against this. Max 20KB. | |
| timeout | No | Timeout in ms (default: 120000, max: 1800000). | |
| workingDirectory | No | Working directory for file resolution. |