Skip to content

Repair malformed tool call inputs#580

Open
jahooma wants to merge 3 commits intomainfrom
jahooma/better-tool-errors
Open

Repair malformed tool call inputs#580
jahooma wants to merge 3 commits intomainfrom
jahooma/better-tool-errors

Conversation

@jahooma
Copy link
Copy Markdown
Contributor

@jahooma jahooma commented May 2, 2026

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.

…rrors

# Conflicts:
#	packages/agent-runtime/src/__tests__/tool-validation-error.test.ts
#	packages/agent-runtime/src/tools/tool-executor.ts
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.

1 participant