@@ -117,8 +117,8 @@ public void after() {
117
117
// ---------------------------------------
118
118
// Sampling Tests
119
119
// ---------------------------------------
120
- // @ParameterizedTest(name = "{0} : {displayName} ")
121
- // @ValueSource(strings = { "httpclient", "webflux" })
120
+ @ ParameterizedTest (name = "{0} : {displayName} " )
121
+ @ ValueSource (strings = { "httpclient" , "webflux" })
122
122
void testCreateMessageWithoutSamplingCapabilities (String clientType ) {
123
123
124
124
var clientBuilder = clientBuilders .get (clientType );
@@ -298,8 +298,8 @@ void testCreateMessageWithRequestTimeoutSuccess(String clientType) throws Interr
298
298
mcpServer .closeGracefully ().block ();
299
299
}
300
300
301
- // @ParameterizedTest(name = "{0} : {displayName} ")
302
- // @ValueSource(strings = { "httpclient", "webflux" })
301
+ @ ParameterizedTest (name = "{0} : {displayName} " )
302
+ @ ValueSource (strings = { "httpclient" , "webflux" })
303
303
void testCreateMessageWithRequestTimeoutFail (String clientType ) throws InterruptedException {
304
304
305
305
// Client
@@ -361,20 +361,16 @@ void testCreateMessageWithRequestTimeoutFail(String clientType) throws Interrupt
361
361
// ---------------------------------------
362
362
// Elicitation Tests
363
363
// ---------------------------------------
364
- // @ParameterizedTest(name = "{0} : {displayName} ")
365
- // @ValueSource(strings = { "httpclient", "webflux" })
364
+ @ ParameterizedTest (name = "{0} : {displayName} " )
365
+ @ ValueSource (strings = { "httpclient" , "webflux" })
366
366
void testCreateElicitationWithoutElicitationCapabilities (String clientType ) {
367
367
368
368
var clientBuilder = clientBuilders .get (clientType );
369
369
370
370
McpServerFeatures .AsyncToolSpecification tool = McpServerFeatures .AsyncToolSpecification .builder ()
371
371
.tool (new Tool ("tool1" , "tool1 description" , emptyJsonSchema ))
372
- .callHandler ((exchange , request ) -> {
373
-
374
- exchange .createElicitation (mock (ElicitRequest .class )).block ();
375
-
376
- return Mono .just (mock (CallToolResult .class ));
377
- })
372
+ .callHandler ((exchange , request ) -> exchange .createElicitation (mock (ElicitRequest .class ))
373
+ .then (Mono .just (mock (CallToolResult .class ))))
378
374
.build ();
379
375
380
376
var server = McpServer .async (mcpStreamableServerTransportProvider )
@@ -515,8 +511,8 @@ void testCreateElicitationWithRequestTimeoutSuccess(String clientType) {
515
511
mcpServer .closeGracefully ().block ();
516
512
}
517
513
518
- // @ParameterizedTest(name = "{0} : {displayName} ")
519
- // @ValueSource(strings = { "httpclient", "webflux" })
514
+ @ ParameterizedTest (name = "{0} : {displayName} " )
515
+ @ ValueSource (strings = { "httpclient" , "webflux" })
520
516
void testCreateElicitationWithRequestTimeoutFail (String clientType ) {
521
517
522
518
var latch = new CountDownLatch (1 );
@@ -547,6 +543,8 @@ void testCreateElicitationWithRequestTimeoutFail(String clientType) {
547
543
548
544
CallToolResult callResponse = new CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )), null );
549
545
546
+ AtomicReference <ElicitResult > resultRef = new AtomicReference <>();
547
+
550
548
McpServerFeatures .AsyncToolSpecification tool = McpServerFeatures .AsyncToolSpecification .builder ()
551
549
.tool (new Tool ("tool1" , "tool1 description" , emptyJsonSchema ))
552
550
.callHandler ((exchange , request ) -> {
@@ -557,13 +555,9 @@ void testCreateElicitationWithRequestTimeoutFail(String clientType) {
557
555
Map .of ("type" , "object" , "properties" , Map .of ("message" , Map .of ("type" , "string" ))))
558
556
.build ();
559
557
560
- StepVerifier .create (exchange .createElicitation (elicitationRequest )).consumeNextWith (result -> {
561
- assertThat (result ).isNotNull ();
562
- assertThat (result .action ()).isEqualTo (ElicitResult .Action .ACCEPT );
563
- assertThat (result .content ().get ("message" )).isEqualTo ("Test message" );
564
- }).verifyComplete ();
565
-
566
- return Mono .just (callResponse );
558
+ return exchange .createElicitation (elicitationRequest )
559
+ .doOnNext (resultRef ::set )
560
+ .then (Mono .just (callResponse ));
567
561
})
568
562
.build ();
569
563
@@ -580,6 +574,9 @@ void testCreateElicitationWithRequestTimeoutFail(String clientType) {
580
574
mcpClient .callTool (new McpSchema .CallToolRequest ("tool1" , Map .of ()));
581
575
}).withMessageContaining ("within 1000ms" );
582
576
577
+ ElicitResult elicitResult = resultRef .get ();
578
+ assertThat (elicitResult ).isNull ();
579
+
583
580
mcpClient .closeGracefully ();
584
581
mcpServer .closeGracefully ().block ();
585
582
}
@@ -634,8 +631,8 @@ void testRootsSuccess(String clientType) {
634
631
mcpServer .close ();
635
632
}
636
633
637
- // @ParameterizedTest(name = "{0} : {displayName} ")
638
- // @ValueSource(strings = { "httpclient", "webflux" })
634
+ @ ParameterizedTest (name = "{0} : {displayName} " )
635
+ @ ValueSource (strings = { "httpclient" , "webflux" })
639
636
void testRootsWithoutCapability (String clientType ) {
640
637
641
638
var clientBuilder = clientBuilders .get (clientType );
0 commit comments