Skip to content

Repair malformed tool call inputs#580

Merged
jahooma merged 4 commits intomainfrom
jahooma/better-tool-errors
May 3, 2026
Merged

Repair malformed tool call inputs#580
jahooma merged 4 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.

jahooma added 2 commits May 1, 2026 23:47
…rrors

# Conflicts:
#	packages/agent-runtime/src/__tests__/tool-validation-error.test.ts
#	packages/agent-runtime/src/tools/tool-executor.ts
@jahooma jahooma merged commit 596a6fc into main May 3, 2026
34 checks passed
@jahooma jahooma deleted the jahooma/better-tool-errors branch May 3, 2026 23:30
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