-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix tool call with empty arguments in streaming mode #4027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix tool call with empty arguments in streaming mode #4027
Conversation
Signed-off-by: huidong.yin <[email protected]>
See the build errors: https://github.com/spring-projects/spring-ai/actions/runs/16780012117/job/47515816009?pr=4027 Thanks. |
- Add null/empty argument handling in DefaultToolCallingManager - Add similar handling in SyncMcpToolCallback and AsyncMcpToolCallback - Add comprehensive test coverage for the fix - Apply Spring Java format to fix code style violations Signed-off-by: huidong.yin <[email protected]>
051e430
to
91aadd3
Compare
got it ,thanks . |
Signed-off-by: huidong.yin <[email protected]>
first time commit code to Spring , not sure what else I need to do. |
spring-ai-model/src/main/java/org/springframework/ai/model/tool/DefaultToolCallingManager.java
Outdated
Show resolved
Hide resolved
- Replace java.util.* with specific imports - Apply Spring Java format to ensure code style compliance Signed-off-by: huidong.yin <[email protected]>
Hi @sobychacko ,Please help review if everything looks good ,thanks |
When method tool or MCP tool with no argument and calling in streaming mode,
errors will occur due to null/empty arguments validation.
This PR adds defensive handling for null/empty tool arguments in streaming mode
by using empty JSON object "{}" as default instead of throwing IllegalArgumentException.
Fixes: #4007