Skip to content
ƒtsforgev0.52.0
19

Fix bad tool calls

2 min read

Sometimes the model sends a tool call that is almost right but not valid JSON for tsforge’s schema: a markdown link instead of a file path, a string where an array was expected, a missing required field.

The repair ladder fixes what it can on the harness side before burning another model turn.

Order: validate → try local fix → only then ask the model to retry.

LevelNameWhenExample
L0Lossless cleanupalways firstunwrap [path](path)path; drop null fields
L1Schema coercionper fieldparse a JSON string into an array
L2Safe defaultsreservedfilled from telemetry over time
L3Re-ask the modelstill invalidmessage names the bad field and shows an example

Model sends file: "[src/foo.ts](src/foo.ts)". L0 unwraps it to src/foo.ts. The edit proceeds without a new model turn.

Model omits required file on edit. L3 tells the model exactly which field is missing, what type was expected, and a sample path. The model retries on the next turn.

Big picture · Model agent