extract_json
Extract valid JSON from messy LLM output by trying the full text, then a fenced json block, then the largest balanced braces.
Instructions
Pull a JSON value out of messy LLM output. Tries the whole text, then a fenced json block, then the largest balanced {...}/[...] substring. Returns the parsed value plus which strategy succeeded.
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": {
"text": "<text>"
},
"name": "extract_json"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Free-form text from an LLM that may contain JSON anywhere inside. |