Use configured MCP mapper for annotated tools - #6698
Open
minsuking wants to merge 1 commit into
Open
Conversation
Pass the configured MCP server JsonMapper into annotated tool providers so @mcptool result serialization follows the server mapper configuration. Add a regression test that verifies a custom snake_case mapper is used for annotated tool results. See spring-projects#4479 Signed-off-by: Minsu <minsu.kim@khmc.or.kr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4479.
Annotation-based MCP tool callbacks did not use the configured
mcpServerJsonMapperwhen converting tool arguments and results.As a result, custom Jackson configurations (for example,
snake_case property naming strategies) were ignored for
methods annotated with
@McpTool.This change propagates the configured
McpJsonMapperfrom the annotation-based providers to generated tool callbacks.
Root Cause
The MCP server auto-configuration correctly created providers
using the configured mapper, but the generated callbacks
continued using their default JSON helper.
Solution
McpJsonMapperJsonMapperoverloads or constructorsTests
Executed:
McpToolInputSchemaITgit diff --checkTargeted MCP tests passed.
Limitations
./mvnw clean packagedid not complete successfully on mylocal Windows environment because the build stopped on
assertion failures in unrelated modules before reaching
the modified MCP modules.
The targeted MCP regression tests completed successfully.