Skip to content
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

Why do we need broadcast messages to clients? #9

Open
JadenHuang2023 opened this issue Feb 15, 2025 · 5 comments
Open

Why do we need broadcast messages to clients? #9

JadenHuang2023 opened this issue Feb 15, 2025 · 5 comments
Labels
bug Something isn't working lifecycle server
Milestone

Comments

@JadenHuang2023
Copy link

logger.debug("Attempting to broadcast message to {} active sessions", sessions.size());

Why do we broadcast responses to all clients instead of just sending them to the current requesting client?

@tzolov
Copy link
Contributor

tzolov commented Feb 18, 2025

@JadenHuang2023, Thanks for the relevant question.
Some server notifications (tools/resource/prompt list changes) should be broadcast to all clients, while server requests related to Roots and Sampling should only go to the initiating client's session. Later is not implemented correctly at the moment. We'll fix this behavior soon.

@JadenHuang2023
Copy link
Author

@tzolov Thanks for your response.
The result of the tool call/tool list, etc should also only be sent to the current requesting client.

@taobaorun
Copy link

https://stackoverflow.com/questions/79456135/java-mcp-sdk-webflux-server-transport-sendmessage-is-broadcasts

The current version of the tool call is also broadcast to all clients。

@marianogonzalez
Copy link
Contributor

marianogonzalez commented Feb 25, 2025

@tzolov will the behavior fix you're describing include avoiding broadcast for tool/call or resource/read responses? Do you happen to have an ETA on that fix? Thanks!

@tzolov
Copy link
Contributor

tzolov commented Feb 26, 2025

@taobaorun, @marianogonzalez we're developing a proper client session management solution that will address all issues mentioned above, including handling for listRoots and createMessage (sampling).

Some early experiments are available at https://github.com/modelcontextprotocol/java-sdk/tree/server-session-support2, and we expect to finalize the solution soon.

@tzolov tzolov added bug Something isn't working server labels Feb 26, 2025
@tzolov tzolov added this to the 0.8.0 milestone Feb 26, 2025
@chemicL chemicL marked this as a duplicate of #29 Mar 4, 2025
@chemicL chemicL marked this as not a duplicate of #29 Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lifecycle server
Projects
None yet
Development

No branches or pull requests

4 participants