parse_partial_json
Parse partial JSON strings from truncated tool calls. Returns complete JSON by safely closing open structures and reports parsing status.
Instructions
Parse a JSON string that may be truncated mid-stream (e.g. a partial LLM tool call). Always returns a valid JSON value with synthetic closure of any open strings, arrays, or objects. Reports whether the input represented a complete top-level value, plus the cursor path where parsing stopped.
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": "parse_partial_json"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The JSON text to parse. May be truncated. | |
| lenient | No | When true (default), tolerates trailing commas, single quotes, unquoted keys, ```json fences, comments, and prose padding. |