@@ -146,8 +146,9 @@ void testCreateMessageSuccess(String clientType) {
146146 CreateMessageResult .StopReason .STOP_SEQUENCE );
147147 };
148148
149- CallToolResult callResponse = new McpSchema .CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )),
150- null );
149+ CallToolResult callResponse = McpSchema .CallToolResult .builder ()
150+ .addContent (new McpSchema .TextContent ("CALL RESPONSE" ))
151+ .build ();
151152
152153 AtomicReference <CreateMessageResult > samplingResult = new AtomicReference <>();
153154
@@ -224,8 +225,9 @@ void testCreateMessageWithRequestTimeoutSuccess(String clientType) throws Interr
224225
225226 // Server
226227
227- CallToolResult callResponse = new McpSchema .CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )),
228- null );
228+ CallToolResult callResponse = McpSchema .CallToolResult .builder ()
229+ .addContent (new McpSchema .TextContent ("CALL RESPONSE" ))
230+ .build ();
229231
230232 AtomicReference <CreateMessageResult > samplingResult = new AtomicReference <>();
231233
@@ -300,8 +302,9 @@ void testCreateMessageWithRequestTimeoutFail(String clientType) throws Interrupt
300302 CreateMessageResult .StopReason .STOP_SEQUENCE );
301303 };
302304
303- CallToolResult callResponse = new McpSchema .CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )),
304- null );
305+ CallToolResult callResponse = McpSchema .CallToolResult .builder ()
306+ .addContent (new McpSchema .TextContent ("CALL RESPONSE" ))
307+ .build ();
305308
306309 McpServerFeatures .AsyncToolSpecification tool = McpServerFeatures .AsyncToolSpecification .builder ()
307310 .tool (Tool .builder ().name ("tool1" ).description ("tool1 description" ).inputSchema (EMPTY_JSON_SCHEMA ).build ())
@@ -393,8 +396,9 @@ void testCreateElicitationSuccess(String clientType) {
393396 Map .of ("message" , request .message ()));
394397 };
395398
396- CallToolResult callResponse = new McpSchema .CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )),
397- null );
399+ CallToolResult callResponse = McpSchema .CallToolResult .builder ()
400+ .addContent (new McpSchema .TextContent ("CALL RESPONSE" ))
401+ .build ();
398402
399403 McpServerFeatures .AsyncToolSpecification tool = McpServerFeatures .AsyncToolSpecification .builder ()
400404 .tool (Tool .builder ().name ("tool1" ).description ("tool1 description" ).inputSchema (EMPTY_JSON_SCHEMA ).build ())
@@ -448,8 +452,9 @@ void testCreateElicitationWithRequestTimeoutSuccess(String clientType) {
448452 return new ElicitResult (ElicitResult .Action .ACCEPT , Map .of ("message" , request .message ()));
449453 };
450454
451- CallToolResult callResponse = new McpSchema .CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )),
452- null );
455+ CallToolResult callResponse = McpSchema .CallToolResult .builder ()
456+ .addContent (new McpSchema .TextContent ("CALL RESPONSE" ))
457+ .build ();
453458
454459 AtomicReference <ElicitResult > resultRef = new AtomicReference <>();
455460
@@ -520,7 +525,7 @@ void testCreateElicitationWithRequestTimeoutFail(String clientType) {
520525 return new ElicitResult (ElicitResult .Action .ACCEPT , Map .of ("message" , request .message ()));
521526 };
522527
523- CallToolResult callResponse = new CallToolResult ( List . of (new McpSchema . TextContent ("CALL RESPONSE" )), null );
528+ CallToolResult callResponse = CallToolResult . builder (). addContent (new TextContent ("CALL RESPONSE" )). build ( );
524529
525530 AtomicReference <ElicitResult > resultRef = new AtomicReference <>();
526531
@@ -761,7 +766,9 @@ void testToolCallSuccess(String clientType) {
761766 var clientBuilder = clientBuilders .get (clientType );
762767
763768 var responseBodyIsNullOrBlank = new AtomicBoolean (false );
764- var callResponse = new McpSchema .CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )), null );
769+ var callResponse = McpSchema .CallToolResult .builder ()
770+ .addContent (new McpSchema .TextContent ("CALL RESPONSE; ctx=importantValue" ))
771+ .build ();
765772 McpServerFeatures .SyncToolSpecification tool1 = McpServerFeatures .SyncToolSpecification .builder ()
766773 .tool (Tool .builder ().name ("tool1" ).description ("tool1 description" ).inputSchema (EMPTY_JSON_SCHEMA ).build ())
767774 .callHandler ((exchange , request ) -> {
@@ -832,8 +839,7 @@ void testThrowingToolCallIsCaughtBeforeTimeout(String clientType) {
832839 assertThat (initResult ).isNotNull ();
833840
834841 // We expect the tool call to fail immediately with the exception raised by
835- // the offending tool
836- // instead of getting back a timeout.
842+ // the offending tool instead of getting back a timeout.
837843 assertThatExceptionOfType (McpError .class )
838844 .isThrownBy (() -> mcpClient .callTool (new McpSchema .CallToolRequest ("tool1" , Map .of ())))
839845 .withMessageContaining ("Timeout on blocking read" );
@@ -853,8 +859,9 @@ void testToolCallSuccessWithTranportContextExtraction(String clientType) {
853859 var transportContextIsEmpty = new AtomicBoolean (false );
854860 var responseBodyIsNullOrBlank = new AtomicBoolean (false );
855861
856- var expectedCallResponse = new McpSchema .CallToolResult (
857- List .of (new McpSchema .TextContent ("CALL RESPONSE; ctx=value" )), null );
862+ var expectedCallResponse = McpSchema .CallToolResult .builder ()
863+ .addContent (new McpSchema .TextContent ("CALL RESPONSE; ctx=value" ))
864+ .build ();
858865 McpServerFeatures .SyncToolSpecification tool1 = McpServerFeatures .SyncToolSpecification .builder ()
859866 .tool (Tool .builder ().name ("tool1" ).description ("tool1 description" ).inputSchema (EMPTY_JSON_SCHEMA ).build ())
860867 .callHandler ((exchange , request ) -> {
@@ -872,8 +879,9 @@ void testToolCallSuccessWithTranportContextExtraction(String clientType) {
872879 e .printStackTrace ();
873880 }
874881
875- return new McpSchema .CallToolResult (
876- List .of (new McpSchema .TextContent ("CALL RESPONSE; ctx=" + ctxValue )), null );
882+ return McpSchema .CallToolResult .builder ()
883+ .addContent (new McpSchema .TextContent ("CALL RESPONSE; ctx=" + ctxValue ))
884+ .build ();
877885 })
878886 .build ();
879887
@@ -906,7 +914,10 @@ void testToolListChangeHandlingSuccess(String clientType) {
906914
907915 var clientBuilder = clientBuilders .get (clientType );
908916
909- var callResponse = new McpSchema .CallToolResult (List .of (new McpSchema .TextContent ("CALL RESPONSE" )), null );
917+ var callResponse = McpSchema .CallToolResult .builder ()
918+ .addContent (new McpSchema .TextContent ("CALL RESPONSE" ))
919+ .build ();
920+
910921 McpServerFeatures .SyncToolSpecification tool1 = McpServerFeatures .SyncToolSpecification .builder ()
911922 .tool (Tool .builder ().name ("tool1" ).description ("tool1 description" ).inputSchema (EMPTY_JSON_SCHEMA ).build ())
912923 .callHandler ((exchange , request ) -> {
0 commit comments