Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public abstract class Protocol(
LOGGER.trace { "Received progress notification: token=${notification.progressToken}, progress=${notification.progress}/${notification.total}" }
val progress = notification.progress
val total = notification.total
val message = notification.message
val progressToken = notification.progressToken

val handler = progressHandlers[progressToken]
Expand All @@ -272,7 +273,7 @@ public abstract class Protocol(
return
}

handler.invoke(Progress(progress, total))
handler.invoke(Progress(progress, total, message))
}

private fun onResponse(response: JSONRPCResponse?, error: JSONRPCError?) {
Expand Down
11 changes: 11 additions & 0 deletions src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ public sealed interface ProgressBase {
* Total number of items to a process (or total progress required), if known.
*/
public val total: Double?

/**
* An optional message describing the current progress.
*/
public val message: String?
}

/* Progress notifications */
Expand All @@ -530,6 +535,11 @@ public open class Progress(
* Total number of items to a process (or total progress required), if known.
*/
override val total: Double?,

/**
* An optional message describing the current progress.
*/
override val message: String?,
) : ProgressBase

/**
Expand All @@ -546,6 +556,7 @@ public data class ProgressNotification(
public val progressToken: ProgressToken,
@Suppress("PropertyName") val _meta: JsonObject = EmptyJsonObject,
override val total: Double?,
override val message: String?,
) : ClientNotification, ServerNotification, ProgressBase {
override val method: Method = Method.Defined.NotificationsProgress
}
Expand Down
Loading