Skip to content

fix: normalize tool-call input with schema-aware lossless unwrap#63

Merged
jbj338033 merged 1 commit into
mainfrom
fix/tool-input-normalization
Jun 16, 2026
Merged

fix: normalize tool-call input with schema-aware lossless unwrap#63
jbj338033 merged 1 commit into
mainfrom
fix/tool-input-normalization

Conversation

@jbj338033

Copy link
Copy Markdown
Collaborator

Summary

LLMs occasionally over-process tool-call arguments — wrapping an object/array in an extra JSON string (whole-argument or single-field stringify). The engine previously coerced any non-object input to an empty object, silently discarding the arguments. This normalizes tool input once, schema-aware and language-agnostic: it losslessly unwraps stringified objects and stringified array/object fields (driven by each tool's declared schema), and preserves non-normalizable input so the tool's own parser returns a clear error the model can correct, instead of running on empty args. The single normalized value is shared by dispatch, history, and display.

Verification

  • cargo fmt --all — passed
  • cargo clippy --workspace --all-targets -- -D warnings — passed
  • cargo test --workspace — passed (goat-agent 86 tests incl. new normalization cases: whole/field stringify unwrap, string-field protection, multilingual payloads, idempotency, non-object preservation)

@jbj338033 jbj338033 merged commit 03358b6 into main Jun 16, 2026
5 checks passed
@jbj338033 jbj338033 deleted the fix/tool-input-normalization branch June 16, 2026 06:38
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