-
Notifications
You must be signed in to change notification settings - Fork 178
Add options in Transport.send method
#408
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
Conversation
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.
Pull Request Overview
This PR extends the Transport.send method signature to accept an optional TransportSendOptions parameter, enabling advanced transport features like resumption tokens, progress callbacks, and request-response association tracking. The change is backward compatible as the new parameter has a default null value.
Key changes:
- Introduced new
TransportSendOptionsclass withrelatedRequestId,resumptionToken, andonResumptionTokenproperties - Modified
RequestOptionsto extendTransportSendOptions, inheriting transport-level options while adding request-specific fields - Updated all transport implementations to accept the new options parameter
- Modified
Protocolclass to pass options through to transport layer when sending requests and notifications
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions.kt | New class defining transport-level send options for message association, resumption tokens, and callbacks |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Transport.kt | Updated send method signature to accept optional TransportSendOptions parameter |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Protocol.kt | Modified RequestOptions to extend TransportSendOptions; updated request and notification methods to pass options to transport |
| kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/WebSocketMcpTransport.kt | Updated send method to accept TransportSendOptions parameter |
| kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransport.kt | Updated send method to extract and use resumption token from TransportSendOptions |
| kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport.kt | Updated send method signature to accept TransportSendOptions parameter |
| kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SSEClientTransport.kt | Updated send method signature to accept TransportSendOptions parameter |
| kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/StdioServerTransport.kt | Updated send method signature to accept TransportSendOptions parameter |
| kotlin-sdk-server/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/server/SSEServerTransport.kt | Updated send method signature to accept TransportSendOptions parameter |
| kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/ProtocolTest.kt | Updated test transport implementation to accept TransportSendOptions parameter |
| kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/InMemoryTransport.kt | Updated test transport to accept TransportSendOptions parameter |
| kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/OldSchemaInMemoryTransport.kt | Updated test transport to accept TransportSendOptions parameter |
| kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/ClientTest.kt | Updated test transport implementations to accept TransportSendOptions parameter |
| kotlin-sdk-test/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/OldSchemaClientTest.kt | Updated test transport implementations to accept TransportSendOptions parameter |
| kotlin-sdk-client/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/MockTransport.kt | Updated mock transport to accept TransportSendOptions parameter |
| kotlin-sdk-client/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/OldSchemaMockTransport.kt | Updated mock transport to accept TransportSendOptions parameter |
| kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/typescript/sse/KotlinServerForTsClientSse.kt | Updated HTTP server transport to accept TransportSendOptions parameter |
| kotlin-sdk-test/src/jvmTest/kotlin/io/modelcontextprotocol/kotlin/sdk/integration/typescript/sse/OldSchemaKotlinServerForTsClientSse.kt | Updated HTTP server transport to accept TransportSendOptions parameter |
| kotlin-sdk-core/api/kotlin-sdk-core.api | Updated API signatures for Transport.send, RequestOptions, and Protocol.notification methods |
| kotlin-sdk-client/api/kotlin-sdk-client.api | Updated API signatures for client transport implementations |
| kotlin-sdk-server/api/kotlin-sdk-server.api | Updated API signatures for server transport implementations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions.kt
Show resolved
Hide resolved
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Protocol.kt
Show resolved
Hide resolved
kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Transport.kt
Show resolved
Hide resolved
…ansport implementations.
…ptions` parameters
dbeca97 to
257fcff
Compare
Add support for
TransportSendOptionsinTransport.sendmethodMotivation and Context
This change extends the
Transport.sendmethod signature to support advanced transport features like resumption tokens and progress callbacks. This is needed to enable:needed for #235
How Has This Been Tested?
All transport tests passed
Breaking Changes
Yes, it’s necessary to update the custom Transport implementations.
For users who rely on the transports provided by the sdk, there’s no breaking change
Types of changes
Checklist