Skip to content

fix: accept empty dict as valid tool_args#1447

Closed
thakoreh wants to merge 1 commit intoagent0ai:mainfrom
thakoreh:fix/validate-tool-request-empty-args
Closed

fix: accept empty dict as valid tool_args#1447
thakoreh wants to merge 1 commit intoagent0ai:mainfrom
thakoreh:fix/validate-tool-request-empty-args

Conversation

@thakoreh
Copy link
Copy Markdown

@thakoreh thakoreh commented Apr 4, 2026

Problem

`validate_tool_request` rejects `{"tool_name": "x", "tool_args": {}}` because `not tool_request.get("tool_args")` evaluates `{}` as falsy.

Fix

Replace the falsy check with `not isinstance(tool_request.get("tool_args"), dict)`. Empty dict is valid, missing or non-dict is not.

Test

5 new tests covering: empty args (valid), missing args (invalid), wrong type (invalid), normal args (valid), None args (invalid).

@3clyp50
Copy link
Copy Markdown
Contributor

3clyp50 commented Apr 7, 2026

Solved in #1466

@3clyp50 3clyp50 closed this Apr 7, 2026
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