Skip to content

Commit dbeca97

Browse files
committed
Add support for TransportSendOptions in send method across all transport implementations.
1 parent e6e38ac commit dbeca97

File tree

21 files changed

+189
-63
lines changed

21 files changed

+189
-63
lines changed

kotlin-sdk-client/api/kotlin-sdk-client.api

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ public final class io/modelcontextprotocol/kotlin/sdk/client/SseClientTransport
6666
public synthetic fun <init> (Lio/ktor/client/HttpClient;Ljava/lang/String;Lkotlin/time/Duration;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
6767
public synthetic fun <init> (Lio/ktor/client/HttpClient;Ljava/lang/String;Lkotlin/time/Duration;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
6868
public fun close (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
69-
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
69+
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
7070
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
7171
}
7272

7373
public final class io/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport : io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport {
7474
public fun <init> (Lkotlinx/io/Source;Lkotlinx/io/Sink;)V
7575
public fun close (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
76-
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
76+
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
7777
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
7878
}
7979

@@ -83,8 +83,8 @@ public final class io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClien
8383
public fun close (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
8484
public final fun getProtocolVersion ()Ljava/lang/String;
8585
public final fun getSessionId ()Ljava/lang/String;
86+
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
8687
public final fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
87-
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
8888
public static synthetic fun send$default (Lio/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransport;Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
8989
public final fun setProtocolVersion (Ljava/lang/String;)V
9090
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/SSEClientTransport.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import io.ktor.http.append
1515
import io.ktor.http.isSuccess
1616
import io.ktor.http.protocolWithAuthority
1717
import io.modelcontextprotocol.kotlin.sdk.shared.AbstractTransport
18+
import io.modelcontextprotocol.kotlin.sdk.shared.TransportSendOptions
1819
import io.modelcontextprotocol.kotlin.sdk.types.JSONRPCMessage
1920
import io.modelcontextprotocol.kotlin.sdk.types.McpJson
2021
import kotlinx.coroutines.CancellationException
@@ -98,7 +99,7 @@ public class SseClientTransport(
9899
}
99100

100101
@OptIn(ExperimentalCoroutinesApi::class)
101-
override suspend fun send(message: JSONRPCMessage) {
102+
override suspend fun send(message: JSONRPCMessage, options: TransportSendOptions?) {
102103
check(initialized.load()) { "SseClientTransport is not initialized!" }
103104
check(job?.isActive == true) { "SseClientTransport is closed!" }
104105
check(endpoint.isCompleted) { "Not connected!" }

kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StdioClientTransport.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import io.github.oshai.kotlinlogging.KotlinLogging
44
import io.modelcontextprotocol.kotlin.sdk.internal.IODispatcher
55
import io.modelcontextprotocol.kotlin.sdk.shared.AbstractTransport
66
import io.modelcontextprotocol.kotlin.sdk.shared.ReadBuffer
7+
import io.modelcontextprotocol.kotlin.sdk.shared.TransportSendOptions
78
import io.modelcontextprotocol.kotlin.sdk.shared.serializeMessage
89
import io.modelcontextprotocol.kotlin.sdk.types.JSONRPCMessage
910
import kotlinx.coroutines.CoroutineName
@@ -100,7 +101,7 @@ public class StdioClientTransport(private val input: Source, private val output:
100101
}
101102
}
102103

103-
override suspend fun send(message: JSONRPCMessage) {
104+
override suspend fun send(message: JSONRPCMessage, options: TransportSendOptions?) {
104105
if (!initialized.load()) {
105106
error("Transport not started")
106107
}

kotlin-sdk-client/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/client/StreamableHttpClientTransport.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import io.ktor.http.contentType
2222
import io.ktor.http.isSuccess
2323
import io.ktor.utils.io.readUTF8Line
2424
import io.modelcontextprotocol.kotlin.sdk.shared.AbstractTransport
25+
import io.modelcontextprotocol.kotlin.sdk.shared.TransportSendOptions
2526
import io.modelcontextprotocol.kotlin.sdk.types.JSONRPCMessage
2627
import io.modelcontextprotocol.kotlin.sdk.types.JSONRPCNotification
2728
import io.modelcontextprotocol.kotlin.sdk.types.JSONRPCRequest
@@ -89,8 +90,8 @@ public class StreamableHttpClientTransport(
8990
/**
9091
* Sends a single message with optional resumption support
9192
*/
92-
override suspend fun send(message: JSONRPCMessage) {
93-
send(message, null)
93+
override suspend fun send(message: JSONRPCMessage, options: TransportSendOptions?) {
94+
send(message, options?.resumptionToken, options?.onResumptionToken)
9495
}
9596

9697
/**

kotlin-sdk-client/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/MockTransport.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.modelcontextprotocol.kotlin.sdk.client
22

33
import io.modelcontextprotocol.kotlin.sdk.shared.Transport
4+
import io.modelcontextprotocol.kotlin.sdk.shared.TransportSendOptions
45
import io.modelcontextprotocol.kotlin.sdk.types.CallToolResult
56
import io.modelcontextprotocol.kotlin.sdk.types.Implementation
67
import io.modelcontextprotocol.kotlin.sdk.types.InitializeResult
@@ -25,7 +26,7 @@ class MockTransport : Transport {
2526

2627
override suspend fun start() = Unit
2728

28-
override suspend fun send(message: JSONRPCMessage) {
29+
override suspend fun send(message: JSONRPCMessage, options: TransportSendOptions?) {
2930
mutex.withLock {
3031
_sentMessages += message
3132
}

kotlin-sdk-client/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/OldSchemaMockTransport.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import io.modelcontextprotocol.kotlin.sdk.JSONRPCRequest
88
import io.modelcontextprotocol.kotlin.sdk.JSONRPCResponse
99
import io.modelcontextprotocol.kotlin.sdk.ServerCapabilities
1010
import io.modelcontextprotocol.kotlin.sdk.shared.Transport
11+
import io.modelcontextprotocol.kotlin.sdk.shared.TransportSendOptions
1112
import kotlinx.coroutines.sync.Mutex
1213
import kotlinx.coroutines.sync.withLock
1314

@@ -25,7 +26,7 @@ class OldSchemaMockTransport : Transport {
2526

2627
override suspend fun start() = Unit
2728

28-
override suspend fun send(message: JSONRPCMessage) {
29+
override suspend fun send(message: JSONRPCMessage, options: TransportSendOptions?) {
2930
mutex.withLock {
3031
_sentMessages += message
3132
}

kotlin-sdk-core/api/kotlin-sdk-core.api

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,8 @@ public abstract class io/modelcontextprotocol/kotlin/sdk/shared/Protocol {
433433
public final fun getRequestHandlers ()Ljava/util/Map;
434434
public final fun getResponseHandlers ()Ljava/util/Map;
435435
public final fun getTransport ()Lio/modelcontextprotocol/kotlin/sdk/shared/Transport;
436-
public final fun notification (Lio/modelcontextprotocol/kotlin/sdk/types/Notification;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
436+
public final fun notification (Lio/modelcontextprotocol/kotlin/sdk/types/Notification;Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
437+
public static synthetic fun notification$default (Lio/modelcontextprotocol/kotlin/sdk/shared/Protocol;Lio/modelcontextprotocol/kotlin/sdk/types/Notification;Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
437438
public fun onClose ()V
438439
public fun onError (Ljava/lang/Throwable;)V
439440
public final fun removeNotificationHandler (Lio/modelcontextprotocol/kotlin/sdk/types/Method;)V
@@ -476,13 +477,13 @@ public final class io/modelcontextprotocol/kotlin/sdk/shared/RequestHandlerExtra
476477
public fun <init> ()V
477478
}
478479

479-
public final class io/modelcontextprotocol/kotlin/sdk/shared/RequestOptions {
480-
public synthetic fun <init> (Lkotlin/jvm/functions/Function1;JILkotlin/jvm/internal/DefaultConstructorMarker;)V
481-
public synthetic fun <init> (Lkotlin/jvm/functions/Function1;JLkotlin/jvm/internal/DefaultConstructorMarker;)V
482-
public final fun component1 ()Lkotlin/jvm/functions/Function1;
483-
public final fun component2-UwyO8pc ()J
484-
public final fun copy-HG0u8IE (Lkotlin/jvm/functions/Function1;J)Lio/modelcontextprotocol/kotlin/sdk/shared/RequestOptions;
485-
public static synthetic fun copy-HG0u8IE$default (Lio/modelcontextprotocol/kotlin/sdk/shared/RequestOptions;Lkotlin/jvm/functions/Function1;JILjava/lang/Object;)Lio/modelcontextprotocol/kotlin/sdk/shared/RequestOptions;
480+
public final class io/modelcontextprotocol/kotlin/sdk/shared/RequestOptions : io/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions {
481+
public synthetic fun <init> (Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;JILkotlin/jvm/internal/DefaultConstructorMarker;)V
482+
public synthetic fun <init> (Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;JLkotlin/jvm/internal/DefaultConstructorMarker;)V
483+
public final fun component4 ()Lkotlin/jvm/functions/Function1;
484+
public final fun component5-UwyO8pc ()J
485+
public final fun copy-9VgGkz4 (Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;J)Lio/modelcontextprotocol/kotlin/sdk/shared/RequestOptions;
486+
public static synthetic fun copy-9VgGkz4$default (Lio/modelcontextprotocol/kotlin/sdk/shared/RequestOptions;Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;JILjava/lang/Object;)Lio/modelcontextprotocol/kotlin/sdk/shared/RequestOptions;
486487
public fun equals (Ljava/lang/Object;)Z
487488
public final fun getOnProgress ()Lkotlin/jvm/functions/Function1;
488489
public final fun getTimeout-UwyO8pc ()J
@@ -495,16 +496,38 @@ public abstract interface class io/modelcontextprotocol/kotlin/sdk/shared/Transp
495496
public abstract fun onClose (Lkotlin/jvm/functions/Function0;)V
496497
public abstract fun onError (Lkotlin/jvm/functions/Function1;)V
497498
public abstract fun onMessage (Lkotlin/jvm/functions/Function2;)V
498-
public abstract fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
499+
public abstract fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
500+
public static synthetic fun send$default (Lio/modelcontextprotocol/kotlin/sdk/shared/Transport;Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
499501
public abstract fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
500502
}
501503

504+
public final class io/modelcontextprotocol/kotlin/sdk/shared/Transport$DefaultImpls {
505+
public static synthetic fun send$default (Lio/modelcontextprotocol/kotlin/sdk/shared/Transport;Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
506+
}
507+
508+
public class io/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions {
509+
public fun <init> ()V
510+
public fun <init> (Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
511+
public synthetic fun <init> (Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
512+
public final fun component1 ()Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;
513+
public final fun component2 ()Ljava/lang/String;
514+
public final fun component3 ()Lkotlin/jvm/functions/Function1;
515+
public fun copy (Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;
516+
public static synthetic fun copy$default (Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;
517+
public fun equals (Ljava/lang/Object;)Z
518+
public final fun getOnResumptionToken ()Lkotlin/jvm/functions/Function1;
519+
public final fun getRelatedRequestId ()Lio/modelcontextprotocol/kotlin/sdk/types/RequestId;
520+
public final fun getResumptionToken ()Ljava/lang/String;
521+
public fun hashCode ()I
522+
public fun toString ()Ljava/lang/String;
523+
}
524+
502525
public abstract class io/modelcontextprotocol/kotlin/sdk/shared/WebSocketMcpTransport : io/modelcontextprotocol/kotlin/sdk/shared/AbstractTransport {
503526
public fun <init> ()V
504527
public fun close (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
505528
protected abstract fun getSession ()Lio/ktor/websocket/WebSocketSession;
506529
protected abstract fun initializeSession (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
507-
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
530+
public fun send (Lio/modelcontextprotocol/kotlin/sdk/types/JSONRPCMessage;Lio/modelcontextprotocol/kotlin/sdk/shared/TransportSendOptions;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
508531
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
509532
}
510533

kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Protocol.kt

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,62 @@ public val DEFAULT_REQUEST_TIMEOUT: Duration = 60.seconds
9393

9494
/**
9595
* Options that can be given per request.
96+
*
97+
* @property relatedRequestId if present,
98+
* `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
99+
* @property resumptionToken the resumption token used to continue long-running requests that were interrupted.
100+
* This allows clients to reconnect and continue from where they left off, if supported by the transport.
101+
* @property onResumptionToken a callback that is invoked when the resumption token changes, if supported by the transport.
102+
* This allows clients to persist the latest token for potential reconnection.
103+
* @property onProgress callback for progress notifications.
104+
* If set, requests progress notifications from the remote end (if supported).
105+
* When progress notifications are received, this callback will be invoked.
106+
* @property timeout a timeout for this request.
107+
* If exceeded, a McpException with code `RequestTimeout` will be raised from request().
108+
* If not specified, `DEFAULT_REQUEST_TIMEOUT` will be used as the timeout.
96109
*/
97-
public data class RequestOptions(
98-
/**
99-
* If set, requests progress notifications from the remote end (if supported).
100-
* When progress notifications are received, this callback will be invoked.
101-
*/
102-
val onProgress: ProgressCallback? = null,
110+
public class RequestOptions(
111+
relatedRequestId: RequestId? = null,
112+
resumptionToken: String? = null,
113+
onResumptionToken: ((String) -> Unit)? = null,
114+
public val onProgress: ProgressCallback? = null,
115+
public val timeout: Duration = DEFAULT_REQUEST_TIMEOUT,
116+
) : TransportSendOptions(relatedRequestId, resumptionToken, onResumptionToken) {
117+
public operator fun component4(): ProgressCallback? = onProgress
118+
public operator fun component5(): Duration = timeout
119+
120+
public fun copy(
121+
relatedRequestId: RequestId? = this.relatedRequestId,
122+
resumptionToken: String? = this.resumptionToken,
123+
onResumptionToken: ((String) -> Unit)? = this.onResumptionToken,
124+
onProgress: ProgressCallback? = this.onProgress,
125+
timeout: Duration = this.timeout,
126+
): RequestOptions = RequestOptions(relatedRequestId, resumptionToken, onResumptionToken, onProgress, timeout)
127+
128+
override fun equals(other: Any?): Boolean {
129+
if (this === other) return true
130+
if (other == null || this::class != other::class) return false
131+
if (!super.equals(other)) return false
132+
133+
other as RequestOptions
134+
135+
return when {
136+
onProgress != other.onProgress -> false
137+
timeout != other.timeout -> false
138+
else -> true
139+
}
140+
}
103141

104-
/**
105-
* A timeout for this request. If exceeded, an McpError with code `RequestTimeout`
106-
* will be raised from request().
107-
*
108-
* If not specified, `DEFAULT_REQUEST_TIMEOUT` will be used as the timeout.
109-
*/
110-
val timeout: Duration = DEFAULT_REQUEST_TIMEOUT,
111-
)
142+
override fun hashCode(): Int {
143+
var result = super.hashCode()
144+
result = 31 * result + (onProgress?.hashCode() ?: 0)
145+
result = 31 * result + timeout.hashCode()
146+
return result
147+
}
148+
149+
override fun toString(): String =
150+
"RequestOptions(relatedRequestId=$relatedRequestId, resumptionToken=$resumptionToken, onResumptionToken=$onResumptionToken, onProgress=$onProgress, timeout=$timeout)"
151+
}
112152

113153
/**
114154
* Extra data given to request handlers.
@@ -456,11 +496,9 @@ public abstract class Protocol(@PublishedApi internal val options: ProtocolOptio
456496
),
457497
)
458498

459-
val serialized = JSONRPCNotification(
460-
notification.method.value,
461-
params = McpJson.encodeToJsonElement(notification),
462-
)
463-
transport.send(serialized)
499+
val jsonRpcNotification = notification.toJSON()
500+
501+
transport.send(jsonRpcNotification, options)
464502

465503
result.completeExceptionally(reason)
466504
}
@@ -469,7 +507,7 @@ public abstract class Protocol(@PublishedApi internal val options: ProtocolOptio
469507
try {
470508
withTimeout(timeout) {
471509
logger.trace { "Sending request message with id: $jsonRpcRequestId" }
472-
this@Protocol.transport?.send(jsonRpcRequest)
510+
this@Protocol.transport?.send(jsonRpcRequest, options)
473511
}
474512
return result.await()
475513
} catch (cause: TimeoutCancellationException) {
@@ -489,13 +527,14 @@ public abstract class Protocol(@PublishedApi internal val options: ProtocolOptio
489527
/**
490528
* Emits a notification, which is a one-way message that does not expect a response.
491529
*/
492-
public suspend fun notification(notification: Notification) {
530+
public suspend fun notification(notification: Notification, relatedRequestId: RequestId? = null) {
493531
logger.trace { "Sending notification: ${notification.method}" }
494532
val transport = this.transport ?: error("Not connected")
495533
assertNotificationCapability(notification.method)
534+
val sendOptions = relatedRequestId?.let { TransportSendOptions(relatedRequestId = it) }
535+
val jsonRpcNotification = notification.toJSON()
496536

497-
val message = notification.toJSON()
498-
transport.send(message)
537+
transport.send(jsonRpcNotification, sendOptions)
499538
}
500539

501540
/**

kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/shared/Transport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public interface Transport {
1919
/**
2020
* Sends a JSON-RPC message (request or response).
2121
*/
22-
public suspend fun send(message: JSONRPCMessage)
22+
public suspend fun send(message: JSONRPCMessage, options: TransportSendOptions? = null)
2323

2424
/**
2525
* Closes the connection.

0 commit comments

Comments
 (0)