feat(server): expose client implementation and capabilities to handlers#733
Open
jskjw157 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
feat(server): expose client implementation and capabilities to handlers#733jskjw157 wants to merge 1 commit intomodelcontextprotocol:mainfrom
jskjw157 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
ba5f1aa to
ab167b0
Compare
ab167b0 to
03fff84
Compare
9 tasks
Contributor
Author
|
@devcrocod when you get a chance — implements #552 by delegating to what |
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.
Adds
clientImplementationandclientCapabilitiesproperties onClientConnection, delegating to whatServerSessionalready tracks during the initialize handshake.closes #552
Motivation and Context
Server handlers (tools, prompts, resources) currently have no first-class way to read the connected client's name/version or advertised capabilities. The only workaround is to extract the full
ServerSessionfrom theServerinstance viasessionId— awkward, and easy to get wrong. This blocks two real use cases:createMessage/listRoots/createElicitationfail with a non-specificIllegalStateExceptionHow Has This Been Tested?
Integration tests in
ClientConnectionTestassert both properties are populated inside tool, prompt, and resource handlers (matching the existingcallAllMethodspattern that exercises everyClientConnectionmember).Breaking Changes
None for consumers. Adds two abstract members to
ClientConnection, which would require any external implementer to recompile — butClientConnectionImplis the only implementation and isinternal.A small naming note:
clientImplementationmatches the MCP spec'sclientInfo: Implementationfield as suggested in the issue. This creates temporary dual naming with the existingServerSession.clientVersion(also anImplementation). RenamingServerSession.clientVersionis a wider public-API change, so I left it as a follow-up unless maintainers want it bundled here.Types of changes
Checklist