-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: Fixed the issue where the returnDirect attribute was not effective on the MCP server side. #3787
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?
Conversation
…not effective on the MCP server side. Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
… unit tests. Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
|
@sunyuhan1998 Thanks for the quick follow up on this! |
mcp/common/src/main/java/org/springframework/ai/mcp/SyncMcpToolCallback.java
Show resolved
Hide resolved
…ange false to true Signed-off-by: rlagyu0 <01086055223@hanmail.net>
# Conflicts: # mcp/common/src/main/java/org/springframework/ai/mcp/AsyncMcpToolCallback.java # mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java # mcp/common/src/main/java/org/springframework/ai/mcp/SyncMcpToolCallback.java # mcp/common/src/test/java/org/springframework/ai/mcp/SyncMcpToolCallbackTests.java
Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
|
Will this fix be added to the 1.1.0.M3 pre-release @markpollack ? |
|
Hi @sunyuhan1998 Sorry about the delay in getting to this. Having the |
Background
Before this PR, when using the
@Toolannotation to define tools on the MCP server side and specifying thereturnDirectattribute, the attribute would not be properly propagated. As a result, the client was unable to retrieve this information. For a detailed discussion and root cause analysis of this issue, please refer to: #3481 .Thanks to the merge of PR #3781 , we now have the foundation to fix this problem.
Changes in This PR
Preserve the
returnDirectAttributeAdjusted the logic in the
McpToolUtilsclass that constructs tool declarations, ensuring that thereturnDirectattribute from the@Toolannotation is correctly retained and passed through.Implemented
getToolMetadataMethodAdded implementations of the
getToolMetadatamethod in bothAsyncMcpToolCallbackandSyncMcpToolCallbackclasses. This enables clients to retrieve tool metadata, including thereturnDirectflag.Added Unit Tests
Included corresponding unit tests to verify the correctness and stability of the above changes.
Fixes: #3481