Skip to content

Conversation

@devcrocod
Copy link
Contributor

Add support for TransportSendOptions in Transport.send method

Motivation and Context

This change extends the Transport.send method signature to support advanced transport features like resumption tokens and progress callbacks. This is needed to enable:

  • Long-running request resumption after reconnection
  • Request-response association tracking
  • Progress token handling in transport layer

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Copy link
Contributor

Copilot AI left a 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 TransportSendOptions class with relatedRequestId, resumptionToken, and onResumptionToken properties
  • Modified RequestOptions to extend TransportSendOptions, inheriting transport-level options while adding request-specific fields
  • Updated all transport implementations to accept the new options parameter
  • Modified Protocol class 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.

@devcrocod devcrocod force-pushed the devcrocod/update-send branch from dbeca97 to 257fcff Compare November 20, 2025 18:49
@devcrocod devcrocod merged commit 2b9dfd9 into main Nov 20, 2025
4 checks passed
@devcrocod devcrocod deleted the devcrocod/update-send branch November 20, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants