-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Client sampling and roots capabilities set to None if not implemented #802
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
Merged
ihrpr
merged 5 commits into
modelcontextprotocol:main
from
lorenzocesconetto:lorenzocesconetto/fix-client-capabilities-info
May 29, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c4ec56d
Client sampling and roots capabilities set to None if not implemented
lorenzocesconetto 8afaefd
refactor: apply formatting
lorenzocesconetto e1203df
Remove TODO comment + uniform style
lorenzocesconetto de2fcfb
Merge branch 'main' into lorenzocesconetto/fix-client-capabilities-info
lorenzocesconetto 75475f2
add comment back
ihrpr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm curious - does this entail that any client that supports roots, or list_roots, supports
roots.listChanged
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth putting the comment back, sorry.
The client can send list changes, as the code is there to trigger that notification, so it's supported.
But the spec says "listChanged indicates whether the client will emit notifications when the list of roots changes."
We do need to address this, but a separate PR would be probably be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the comment back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if I follow...
So I read the comment as asking - should the
listChanged=True
be included if and only if the client WILL send a notification when the roots list is changed, or that it MAY (i.e., it "supports it"). And I think I even said roughly "this is answered in the spec":So if that's the meaning of the question/comment, I think it's answered by the spec. My question was - if a client SUPPORTS ROOTS (e.g. they support "roots/list"), does it follow that they support "roots/list_changed"?
That's MY question, and it seems to me that the spec implies NO, otherwise (a) why would this be need to be announced in the capabilities; (b) why would the spec talk about "whether the client will emit notifications" if its non-optional.
Cuz the client could (a) not support roots; (b) support roots, and therefore support "roots/list", but not support "notifications/roots/list_changed" (c) support roots, "roots/list" and listChanged.
In the spec it sort of visually implies that SUPPORTS ROOTS -> SUPPORTS ROOTS/LIST -> SUPPORTS NOTIFICATIONS/ROOTS/LIST_CHANGED. But I don't believe this is actually stated anywhere.
So my case is - a client may or may not support roots full stop. If they support roots, then they must support "roots/list" - but that's not something that's declared in the capabilities - but I don't see any language that says that any client that SUPPORTS ROOTS also supports roots/list_changed.
So my reading of: "Clients that support roots MUST declare the roots capability during initialization" is that the existence of the "roots" key indicates support for roots (and therefore list-roots), and the value for
roots.listChanged
indicates support for list_CHANGED. So the capabilities object could have:(1) no roots support:
(2) supports roots (and "roots/list") but not listChanged:
(3) supports roots, "roots/list" and listChanged:
I think this is consistent with the
schema.ts
:capabilities.roots
is optional and is present if the client supports listing roots.capabilities.roots.listChanged
is optional and is true if the client support "roots/list_changed" and false if the client supports "roots/list" but not "roots/list_changed".FWIW, I think this is slightly non-optimal and that
listChanged?: boolean
should belistChanged: boolean
, the "meaning" overal being: if you support roots at all, then you must support "roots/list" (hence, this does not need to be announced), but it's still yes/no if you support "roots/list_changed" (hence that must be announced).The current structure seems to allow:
which I guess is equivalent to:
SO - on my reading, there are three states - (a) no roots (omit the key), (b) "roots/list" support but not "roots/list_changed" (include key and object value and either omit
roots.listChanged
or set it to false, and (c) supports "roots/list_changed" (includeroots.listChanged: true
) - in case (c), the client MUST send "notifications/roots/list_changed" when list changes. This also comports with this:Meaning the presence of the
roots
key is optional and indicates, if present that the client (at least) supports "roots/list".THEN, there is the further announcement of whether they ALSO supports "roots/list_changed", as in:
Pulling it together, the comment is asking: if the client SUPPORTS "roots/list_changed", does it follow that they MAY or that they MUST actually send the notifications?
My question was: if a client SUPPORTS roots, does it follow that they support
listChanged
- (a) does it follow given the logic in this PR? (b) is that what the spec declares? For (b) I say "no", so if the PR entails "yes", then I believe it is against the spec.