Skip to content

feat: add message field to ProgressNotification according to 2025-03-26 spec #69

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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