Skip to content

Conversation

eeaters
Copy link

@eeaters eeaters commented Aug 27, 2025

Background

When migrating local Tools to a standalone service, the returnDirect property stopped working because ToolMetadata in the MCP client currently ignores client-side attributes. Although the MCP SDK schema already defines this field, its logic has not yet been implemented. I previously submitted PR #513
to address this gap, and this change builds on top of that work.

Change Summary

This update allows the client to apply a global configuration for a specific server. The final returnDirect value is computed by merging client and server settings, requiring both sides to be true for the property to take effect.

Because client-side attributes are spread across multiple configuration sources, I introduced a composite class to unify the logic. This is an initial approach; I haven't yet found a cleaner solution. If there are better implementation ideas, I would greatly appreciate suggestions.

This PR addresses and fixes the issues described in ISSUE #3481

…client-level default

- Add `returnDirect` configuration to client properties
- Set default toolAnnotations in client by merging server and client values
- Add returnDirect handling to MCPToolBack

Signed-off-by: eeaters <870905780@qq.com>
@sunyuhan1998
Copy link
Contributor

Thank you for your contribution! I was wondering if this PR addresses the same issue as the previous one: #3787?

@eeaters
Copy link
Author

eeaters commented Aug 27, 2025

Thank you for your contribution! I was wondering if this PR addresses the same issue as the previous one: #3787?

Yes, I saw this PR. However, I think it's somewhat risky to have this parameter entirely controlled by the server side. Therefore, I tried to extend the MCP SDK to also give the client-side the ability to control this parameter simultaneously.

@sunyuhan1998
Copy link
Contributor

Thank you for your contribution! I was wondering if this PR addresses the same issue as the previous one: #3787?

Yes, I saw this PR. However, I think it's somewhat risky to have this parameter entirely controlled by the server side. Therefore, I tried to extend the MCP SDK to also give the client-side the ability to control this parameter simultaneously.

I understand now, thank you for the explanation, it looks great!

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