Skip to content

Commit ed837ba

Browse files
feat: add message field to ProgressNotification to provide descriptive status updates
1 parent 1c5e549 commit ed837ba

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public abstract class Protocol(
260260
LOGGER.trace { "Received progress notification: token=${notification.progressToken}, progress=${notification.progress}/${notification.total}" }
261261
val progress = notification.progress
262262
val total = notification.total
263+
val message = notification.message
263264
val progressToken = notification.progressToken
264265

265266
val handler = progressHandlers[progressToken]
@@ -272,7 +273,7 @@ public abstract class Protocol(
272273
return
273274
}
274275

275-
handler.invoke(Progress(progress, total))
276+
handler.invoke(Progress(progress, total, message))
276277
}
277278

278279
private fun onResponse(response: JSONRPCResponse?, error: JSONRPCError?) {

src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,11 @@ public sealed interface ProgressBase {
510510
* Total number of items to a process (or total progress required), if known.
511511
*/
512512
public val total: Double?
513+
514+
/**
515+
* An optional message describing the current progress.
516+
*/
517+
public val message: String?
513518
}
514519

515520
/* Progress notifications */
@@ -530,6 +535,11 @@ public open class Progress(
530535
* Total number of items to a process (or total progress required), if known.
531536
*/
532537
override val total: Double?,
538+
539+
/**
540+
* An optional message describing the current progress.
541+
*/
542+
override val message: String?,
533543
) : ProgressBase
534544

535545
/**
@@ -546,6 +556,7 @@ public data class ProgressNotification(
546556
public val progressToken: ProgressToken,
547557
@Suppress("PropertyName") val _meta: JsonObject = EmptyJsonObject,
548558
override val total: Double?,
559+
override val message: String?,
549560
) : ClientNotification, ServerNotification, ProgressBase {
550561
override val method: Method = Method.Defined.NotificationsProgress
551562
}

0 commit comments

Comments
 (0)