Expand description
Argmend repairs broken tool-call arguments into JSON.
Callers pass the raw argument string and, when they have it, the tool’s JSON schema.
Match RepairOutcome, RewriteKind, and RepairError with a
wildcard arm. A later release can add a variant. Build RepairRequest
with RepairRequest::new so a new field is not required.
RepairRequest::with_options turns off path backslashes, alias
renames, or truncation closing. The default keeps those repairs on.
embedded_json stays off. Set it to parse one JSON string when the
schema type is an object or an array. leading_prose stays off.
Set it and pass the options to repair_json_with to take one
object or array after a prefix. wrap_scalar stays off.
normalize uses those defaults. normalize_with is the same
call with explicit switches.
repair_args and normalize produce JSON. A successful result is
not a promise that the schema accepts it. The host still validates
before it runs a tool.
Structs§
- Argument
Preview - A look at a tool-call argument that may still be streaming.
- Repair
Options - Which repairs
repair_argsmay apply. - Repair
Request - Arguments plus an optional JSON schema.
- Repaired
- A value the host can execute, with every rewrite that produced it.
- Rewrite
- One recorded rewrite. Valid JSON that needs no schema change has none.
Enums§
- Repair
Error - Repair refused.
RepairError::Ambiguousis not a guess. - Repair
Outcome - Result of
repair_json. - Rewrite
Kind - Why a rewrite was applied.
Functions§
- normalize
- Apply a tool schema to an already-parsed value.
- normalize_
with normalizewith explicit repair switches.- preview_
args - Preview a tool-call argument while tokens are still arriving.
- repair_
args - Parse
raw, then applynormalizewhen a schema is present. - repair_
json - Syntax repair only. Empty input and garbage stay
RepairOutcome::Unfixable. - repair_
json_ with repair_jsonwithRepairOptions.- tool_
schema - JSON Schema stored on an OpenAI, Anthropic, or MCP tool definition.