Skip to content

Repair malformed tool call inputs#578

Merged
jahooma merged 1 commit intomainfrom
jahooma/fix-tool-json-errors
May 2, 2026
Merged

Repair malformed tool call inputs#578
jahooma merged 1 commit intomainfrom
jahooma/fix-tool-json-errors

Conversation

@brandonkachen
Copy link
Copy Markdown
Collaborator

Handles common malformed tool-call inputs from models by parsing stringified JSON arguments, normalizing str_replace replacement aliases, and applying narrow bare-string repairs for safe discovery tools. This reduces retry loops for errors like old_string/new_string replacements and unquoted path or pattern values while still rejecting risky malformed write_file and spawn_agents payloads. Added focused tests for the repair behavior and validation error handling.

Validation: bun test common/src/tools/params/__tests__/coerce-to-array.test.ts; bun test packages/agent-runtime/src/__tests__/tool-validation-error.test.ts; bun run --cwd common typecheck; bun run --cwd packages/agent-runtime typecheck.

@jahooma jahooma merged commit 2a2037f into main May 2, 2026
34 checks passed
@jahooma jahooma deleted the jahooma/fix-tool-json-errors branch May 2, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants