@@ -402,6 +402,7 @@ public Mono<Void> closeGracefully() {
402402 // --------------------------
403403 // Initialization
404404 // --------------------------
405+
405406 /**
406407 * The initialization phase should be the first interaction between client and server.
407408 * The client will ensure it happens in case it has not been explicitly called and in
@@ -448,6 +449,7 @@ public Mono<Object> ping() {
448449 // --------------------------
449450 // Roots
450451 // --------------------------
452+
451453 /**
452454 * Adds a new root to the client's root list.
453455 * @param root The root to add.
@@ -625,16 +627,13 @@ private McpSchema.CallToolResult validateToolResult(String toolName, McpSchema.C
625627 * @return A Mono that emits the list of all tools result
626628 */
627629 public Mono <McpSchema .ListToolsResult > listTools () {
628- return this .listTools (McpSchema .FIRST_PAGE )
629- .expand (result -> {
630- String next = result .nextCursor ();
631- return (next != null && !next .isEmpty ()) ? this .listTools (next ) : Mono .empty ();
632- })
633- .reduce (new McpSchema .ListToolsResult (new ArrayList <>(), null ), (allToolsResult , result ) -> {
634- allToolsResult .tools ().addAll (result .tools ());
635- return allToolsResult ;
636- })
637- .map (result -> new McpSchema .ListToolsResult (Collections .unmodifiableList (result .tools ()), null ));
630+ return this .listTools (McpSchema .FIRST_PAGE ).expand (result -> {
631+ String next = result .nextCursor ();
632+ return (next != null && !next .isEmpty ()) ? this .listTools (next ) : Mono .empty ();
633+ }).reduce (new McpSchema .ListToolsResult (new ArrayList <>(), null ), (allToolsResult , result ) -> {
634+ allToolsResult .tools ().addAll (result .tools ());
635+ return allToolsResult ;
636+ }).map (result -> new McpSchema .ListToolsResult (Collections .unmodifiableList (result .tools ()), null ));
638637 }
639638
640639 /**
0 commit comments