From 6bf50b1e67f5ca6c56efa01985d706154befba21 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Wed, 12 Nov 2025 16:30:51 +0100 Subject: [PATCH] Update mcp to 0.16.0 and fix progress-token type Signed-off-by: Christian Tzolov --- .../mcp/context/DefaultMcpAsyncRequestContext.java | 10 ++++++---- .../mcp/context/DefaultMcpSyncRequestContext.java | 7 ++++--- pom.xml | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpAsyncRequestContext.java b/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpAsyncRequestContext.java index 0dab1fc..1aa89e5 100644 --- a/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpAsyncRequestContext.java +++ b/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpAsyncRequestContext.java @@ -175,7 +175,7 @@ public Mono sample(Consumer samplingSpec) { var progressToken = this.request.progressToken(); - if (!Utils.hasText(progressToken)) { + if (progressToken == null || (progressToken instanceof String pt && !Utils.hasText(pt))) { logger.warn("Progress notification not supported by the client!"); } return this.sample(McpSchema.CreateMessageRequest.builder() @@ -220,13 +220,15 @@ public Mono progress(Consumer progressSpec) { progressSpec.accept(spec); - if (!Utils.hasText(this.request.progressToken())) { + var progressToken = this.request.progressToken(); + + if (progressToken == null || (progressToken instanceof String pt && !Utils.hasText(pt))) { logger.warn("Progress notification not supported by the client!"); return Mono.empty(); } - return this.progress(new ProgressNotification(this.request.progressToken(), spec.progress, spec.total, - spec.message, spec.meta)); + return this + .progress(new ProgressNotification(progressToken, spec.progress, spec.total, spec.message, spec.meta)); } @Override diff --git a/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpSyncRequestContext.java b/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpSyncRequestContext.java index d612331..56b3a87 100644 --- a/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpSyncRequestContext.java +++ b/mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpSyncRequestContext.java @@ -270,13 +270,14 @@ public void progress(Consumer progressSpec) { progressSpec.accept(spec); - if (!Utils.hasText(this.request.progressToken())) { + var progressToken = this.request.progressToken(); + + if (progressToken == null || (progressToken instanceof String pt && !Utils.hasText(pt))) { logger.warn("Progress notification not supported by the client!"); return; } - this.progress(new ProgressNotification(this.request.progressToken(), spec.progress, spec.total, spec.message, - spec.meta)); + this.progress(new ProgressNotification(progressToken, spec.progress, spec.total, spec.message, spec.meta)); } @Override diff --git a/pom.xml b/pom.xml index c9deb85..2ee0964 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ 17 17 - 0.15.0 + 0.16.0 4.38.0 2.2.36