modelcontextprotocol / modelcontextprotocol/kotlin-sdk
Make client information available in server handlers
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 1.5k
- Forks
- 248
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 23
Description
Is your feature request related to a problem? Please describe.
It is not possible for server handlers (e.g. tools) to react to information about the client that is connected. Information that is useful includes:
- The client's name & version (aka
Implementation) - useful for patching around specific client behaviors, if some are known to behave poorly or need special handling. - The client capabilities. This is required to know which messages can be sent without resulting in unexpected exceptions or erroneous handling. Graceful fallback is often required when certain capabilities are not supported by clients. It's not really possible to do this currently - calling non-supported methods results in non-specific
IllegalStateExceptions, which could have come from anywhere.
While server capabilities could also be helpful, it's something that you control anyways, so it's much less impactful.
Describe the solution you'd like
Add clientImplementation and clientCapabilities to ClientConnection.
Describe alternatives you've considered
There's a workaround, which is to use the session ID to extract the full ServerSession object from the Server instance. But that's ugly and awkward.
Additional context
Add any other context or screenshots about the feature request here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ClientConnection and the server-handler APIs, then inspect the ServerSession workaround described in the issue to understand where client data is already available. Done means server handlers can access the client's implementation and capabilities without extracting ServerSession through a session ID.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100