@@ -220,7 +220,8 @@ static AsyncToolSpecification fromSync(SyncToolSpecification tool) {
220220 return null ;
221221 }
222222 return new AsyncToolSpecification (tool .tool (),
223- (exchange , map ) -> Mono .fromCallable (() -> tool .call ().apply (exchange , map ))
223+ (exchange , map ) -> Mono
224+ .fromCallable (() -> tool .call ().apply (new McpSyncServerExchange (exchange ), map ))
224225 .subscribeOn (Schedulers .boundedElastic ()));
225226 }
226227 }
@@ -259,7 +260,8 @@ static AsyncResourceSpecification fromSync(SyncResourceSpecification resource) {
259260 return null ;
260261 }
261262 return new AsyncResourceSpecification (resource .resource (),
262- (exchange , req ) -> Mono .fromCallable (() -> resource .readHandler ().apply (exchange , req ))
263+ (exchange , req ) -> Mono
264+ .fromCallable (() -> resource .readHandler ().apply (new McpSyncServerExchange (exchange ), req ))
263265 .subscribeOn (Schedulers .boundedElastic ()));
264266 }
265267 }
@@ -301,7 +303,8 @@ static AsyncPromptSpecification fromSync(SyncPromptSpecification prompt) {
301303 return null ;
302304 }
303305 return new AsyncPromptSpecification (prompt .prompt (),
304- (exchange , req ) -> Mono .fromCallable (() -> prompt .promptHandler ().apply (exchange , req ))
306+ (exchange , req ) -> Mono
307+ .fromCallable (() -> prompt .promptHandler ().apply (new McpSyncServerExchange (exchange ), req ))
305308 .subscribeOn (Schedulers .boundedElastic ()));
306309 }
307310 }
@@ -340,7 +343,7 @@ static AsyncPromptSpecification fromSync(SyncPromptSpecification prompt) {
340343 * returning results
341344 */
342345 public record SyncToolSpecification (McpSchema .Tool tool ,
343- BiFunction <McpAsyncServerExchange , Map <String , Object >, McpSchema .CallToolResult > call ) {
346+ BiFunction <McpSyncServerExchange , Map <String , Object >, McpSchema .CallToolResult > call ) {
344347 }
345348
346349 /**
@@ -369,7 +372,7 @@ public record SyncToolSpecification(McpSchema.Tool tool,
369372 * @param readHandler The function that handles resource read requests
370373 */
371374 public record SyncResourceSpecification (McpSchema .Resource resource ,
372- BiFunction <McpAsyncServerExchange , McpSchema .ReadResourceRequest , McpSchema .ReadResourceResult > readHandler ) {
375+ BiFunction <McpSyncServerExchange , McpSchema .ReadResourceRequest , McpSchema .ReadResourceResult > readHandler ) {
373376 }
374377
375378 /**
@@ -401,7 +404,7 @@ public record SyncResourceSpecification(McpSchema.Resource resource,
401404 * formatted templates
402405 */
403406 public record SyncPromptSpecification (McpSchema .Prompt prompt ,
404- BiFunction <McpAsyncServerExchange , McpSchema .GetPromptRequest , McpSchema .GetPromptResult > promptHandler ) {
407+ BiFunction <McpSyncServerExchange , McpSchema .GetPromptRequest , McpSchema .GetPromptResult > promptHandler ) {
405408 }
406409
407410 // ---------------------------------------
0 commit comments