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.
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. |