| 1 | # Context Doctor |
| 2 | |
| 3 | Repairs model tool call JSON before sending it to history and tool processing. |
| 4 | |
| 5 | ## Behavior |
| 6 | |
| 7 | - Uses `json_repair` after native parsing has completed. |
| 8 | - Accepts only complete Agent Zero tool calls (`tool_name` and object `tool_args`). |
| 9 | - Stores repaired tool calls as compact JSON; log kvps retain streamed reasoning and add transformed fields. |
| 10 | - Optionally replaces XML-like output with `{}` in cases where model uses native XML tool calls. |