Skip to content

Commit 6bf50b1

Browse files
committed
Update mcp to 0.16.0 and fix progress-token type
Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
1 parent 53423b0 commit 6bf50b1

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpAsyncRequestContext.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public Mono<CreateMessageResult> sample(Consumer<SamplingSpec> samplingSpec) {
175175

176176
var progressToken = this.request.progressToken();
177177

178-
if (!Utils.hasText(progressToken)) {
178+
if (progressToken == null || (progressToken instanceof String pt && !Utils.hasText(pt))) {
179179
logger.warn("Progress notification not supported by the client!");
180180
}
181181
return this.sample(McpSchema.CreateMessageRequest.builder()
@@ -220,13 +220,15 @@ public Mono<Void> progress(Consumer<ProgressSpec> progressSpec) {
220220

221221
progressSpec.accept(spec);
222222

223-
if (!Utils.hasText(this.request.progressToken())) {
223+
var progressToken = this.request.progressToken();
224+
225+
if (progressToken == null || (progressToken instanceof String pt && !Utils.hasText(pt))) {
224226
logger.warn("Progress notification not supported by the client!");
225227
return Mono.empty();
226228
}
227229

228-
return this.progress(new ProgressNotification(this.request.progressToken(), spec.progress, spec.total,
229-
spec.message, spec.meta));
230+
return this
231+
.progress(new ProgressNotification(progressToken, spec.progress, spec.total, spec.message, spec.meta));
230232
}
231233

232234
@Override

mcp-annotations/src/main/java/org/springaicommunity/mcp/context/DefaultMcpSyncRequestContext.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,14 @@ public void progress(Consumer<ProgressSpec> progressSpec) {
270270

271271
progressSpec.accept(spec);
272272

273-
if (!Utils.hasText(this.request.progressToken())) {
273+
var progressToken = this.request.progressToken();
274+
275+
if (progressToken == null || (progressToken instanceof String pt && !Utils.hasText(pt))) {
274276
logger.warn("Progress notification not supported by the client!");
275277
return;
276278
}
277279

278-
this.progress(new ProgressNotification(this.request.progressToken(), spec.progress, spec.total, spec.message,
279-
spec.meta));
280+
this.progress(new ProgressNotification(progressToken, spec.progress, spec.total, spec.message, spec.meta));
280281
}
281282

282283
@Override

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<maven.compiler.source>17</maven.compiler.source>
5757
<maven.compiler.target>17</maven.compiler.target>
5858

59-
<mcp.java.sdk.version>0.15.0</mcp.java.sdk.version>
59+
<mcp.java.sdk.version>0.16.0</mcp.java.sdk.version>
6060

6161
<jsonschema.version>4.38.0</jsonschema.version>
6262
<swagger-annotations.version>2.2.36</swagger-annotations.version>

0 commit comments

Comments
 (0)