kotlin-sdk/integration-test
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Nett 4a08959121
feat! Add context to server call handlers (#515)
## Motivation and Context

Adds a `ClientConnection` context receiver to server call handlers,
which provides access to the client communication channel. This is
necessary to allow tools to send notifications, logging, elicitations,
etc.

Supersedes https://github.com/modelcontextprotocol/kotlin-sdk/pull/144,
discussed in
https://github.com/modelcontextprotocol/kotlin-sdk/issues/295.

## How Has This Been Tested?

With the added integration test.

## Breaking Changes

It breaks binary compatibility and breaks source compatibility for tool
handlers that already use `this`.

If you care a lot about maintaining compatibility, I could add some
overloads to ease the transition. But the new methods would likely need
to be named differently for resolution.

Future compatibility should be easier to maintain - `Context` is an
interface (with experimental opt-in subclassing), so new fields can be
added without breaking compatibility. Different types could also be
introduced for different handles without breaking compatibility, as long
as they extend `ClientConnection`.

## Types of changes
<!-- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update

## Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [x] I have added or updated documentation as needed

## Additional context
<!-- Add any other context, implementation notes, or design decisions
-->

---------

Co-authored-by: Konstantin Pavlov <1517853+kpavlov@users.noreply.github.com>
2026-02-23 16:30:15 +02:00
..
src feat! Add context to server call handlers (#515) 2026-02-23 16:30:15 +02:00
build.gradle.kts feat: Add kotlin-sdk-testing module with channel-based transport implementation (#505) 2026-02-16 14:10:56 +02:00
detekt-baseline-commonTestSourceSet.xml refactor: Harden detekt setup, address some issues (#507) 2026-02-13 22:17:27 +02:00
detekt-baseline-test.xml feat! Add context to server call handlers (#515) 2026-02-23 16:30:15 +02:00