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 @@ -380,6 +380,9 @@ public Mono<Void> addTools(List<McpServerFeatures.AsyncToolSpecification> toolSp
380380 if (toolSpecifications .isEmpty ()) {
381381 return Mono .empty ();
382382 }
383+ if (this .serverCapabilities .tools () == null ) {
384+ return Mono .error (new IllegalStateException ("Server must be configured with tool capabilities" ));
385+ }
383386
384387 Map <String , McpServerFeatures .AsyncToolSpecification > wrappedToolSpecificationsByName ;
385388 try {
@@ -388,9 +391,6 @@ public Mono<Void> addTools(List<McpServerFeatures.AsyncToolSpecification> toolSp
388391 catch (IllegalArgumentException e ) {
389392 return Mono .error (e );
390393 }
391- if (this .serverCapabilities .tools () == null ) {
392- return Mono .error (new IllegalStateException ("Server must be configured with tool capabilities" ));
393- }
394394
395395 return Mono .defer (() -> {
396396 this .tools .removeIf (
Original file line number Diff line number Diff line change @@ -369,6 +369,9 @@ public Mono<Void> addTools(List<McpStatelessServerFeatures.AsyncToolSpecificatio
369369 if (toolSpecifications .isEmpty ()) {
370370 return Mono .empty ();
371371 }
372+ if (this .serverCapabilities .tools () == null ) {
373+ return Mono .error (new IllegalStateException ("Server must be configured with tool capabilities" ));
374+ }
372375
373376 Map <String , McpStatelessServerFeatures .AsyncToolSpecification > wrappedToolSpecificationsByName ;
374377 try {
@@ -377,9 +380,6 @@ public Mono<Void> addTools(List<McpStatelessServerFeatures.AsyncToolSpecificatio
377380 catch (IllegalArgumentException e ) {
378381 return Mono .error (e );
379382 }
380- if (this .serverCapabilities .tools () == null ) {
381- return Mono .error (new IllegalStateException ("Server must be configured with tool capabilities" ));
382- }
383383
384384 return Mono .defer (() -> {
385385 this .tools .removeIf (
You can’t perform that action at this time.
0 commit comments