File tree Expand file tree Collapse file tree
mcp-core/src/main/java/io/modelcontextprotocol/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -377,12 +377,13 @@ public Mono<Void> addTools(List<McpServerFeatures.AsyncToolSpecification> toolSp
377377 if (toolSpecifications == null ) {
378378 return Mono .error (new IllegalArgumentException ("Tool specifications must not be null" ));
379379 }
380- if (toolSpecifications .isEmpty ()) {
381- return Mono .empty ();
382- }
380+
383381 if (this .serverCapabilities .tools () == null ) {
384382 return Mono .error (new IllegalStateException ("Server must be configured with tool capabilities" ));
385383 }
384+ if (toolSpecifications .isEmpty ()) {
385+ return Mono .empty ();
386+ }
386387
387388 Map <String , McpServerFeatures .AsyncToolSpecification > wrappedToolSpecificationsByName ;
388389 try {
Original file line number Diff line number Diff line change @@ -366,13 +366,14 @@ public Mono<Void> addTools(List<McpStatelessServerFeatures.AsyncToolSpecificatio
366366 if (toolSpecifications == null ) {
367367 return Mono .error (new IllegalArgumentException ("Tool specifications must not be null" ));
368368 }
369- if (toolSpecifications .isEmpty ()) {
370- return Mono .empty ();
371- }
372369 if (this .serverCapabilities .tools () == null ) {
373370 return Mono .error (new IllegalStateException ("Server must be configured with tool capabilities" ));
374371 }
375372
373+ if (toolSpecifications .isEmpty ()) {
374+ return Mono .empty ();
375+ }
376+
376377 Map <String , McpStatelessServerFeatures .AsyncToolSpecification > wrappedToolSpecificationsByName ;
377378 try {
378379 wrappedToolSpecificationsByName = sanitizeToolSpecifications (toolSpecifications );
You can’t perform that action at this time.
0 commit comments