Skip to content

Conversation

@tzolov
Copy link
Contributor

@tzolov tzolov commented Dec 4, 2025

Add proper exception handling for JSON processing failures in tool argument extraction and conversion. Wrap JsonProcessingException in ToolExecutionException to provide better error context when tools receive malformed input.

Resolves: #3924 #4987 #3933

Add proper exception handling for JSON processing failures in tool
argument extraction and conversion. Wrap JsonProcessingException in
ToolExecutionException to provide better error context when tools
receive malformed input.

Resolves: spring-projects#3924 spring-projects#4987 spring-projects#3933

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov added this to the 2.0.0.M1 milestone Dec 4, 2025
@ilayaperumalg ilayaperumalg self-assigned this Dec 4, 2025
return JsonParser.fromJson(toolInput, new TypeReference<>() {
});
}
catch (IllegalStateException ex) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of checking just the IllegalStateException, we agreed to check all exception which is similar to how MCP toolcallback error handling is done. I will make the change and update the PR.

@ilayaperumalg ilayaperumalg merged commit 8e972a4 into spring-projects:main Dec 4, 2025
2 checks passed
@ilayaperumalg
Copy link
Member

Rebased and merged as 8e972a4 along with 65429d9. Also, cherry-picked into 1.1.x via d4f22ce along with b0a97c7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MethodToolCallback does not handle invalid arg gracefully

2 participants