Skip to content

Commit f5098e8

Browse files
markpollackchedim
authored andcommitted
Fix NullPointerException in McpToolUtils.toAsyncToolSpecification
The SyncToolSpecification constructor was being called with null for the call parameter, causing NPE when async version called call().apply(). Fixed by providing proper lambda that wraps Map arguments in CallToolRequest. Signed-off-by: [email protected]
1 parent 1c231d4 commit f5098e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ public static McpServerFeatures.SyncToolSpecification toSyncToolSpecification(To
165165

166166
SharedSyncToolSpecification sharedSpec = toSharedSyncToolSpecification(toolCallback, mimeType);
167167

168-
return new McpServerFeatures.SyncToolSpecification(sharedSpec.tool(), null,
168+
return new McpServerFeatures.SyncToolSpecification(sharedSpec.tool(),
169+
(exchange, map) -> sharedSpec.sharedHandler()
170+
.apply(exchange, new CallToolRequest(sharedSpec.tool().name(), map)),
169171
(exchange, request) -> sharedSpec.sharedHandler().apply(exchange, request));
170172
}
171173

0 commit comments

Comments
 (0)