Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public McpSyncServer mcpSyncServer(McpServerTransportProviderBase transportProvi
ObjectProvider<List<SyncResourceSpecification>> resources,
ObjectProvider<List<SyncPromptSpecification>> prompts,
ObjectProvider<List<SyncCompletionSpecification>> completions,
ObjectProvider<BiConsumer<McpSyncServerExchange, List<McpSchema.Root>>> rootsChangeConsumers,
ObjectProvider<BiConsumer<McpSyncServerExchange, List<McpSchema.Root>>> rootsChangeConsumer,
Environment environment) {

McpSchema.Implementation serverInfo = new Implementation(serverProperties.getName(),
Expand Down Expand Up @@ -179,10 +179,8 @@ public McpSyncServer mcpSyncServer(McpServerTransportProviderBase transportProvi
}
}

rootsChangeConsumers.ifAvailable(consumer -> {
BiConsumer<McpSyncServerExchange, List<McpSchema.Root>> syncConsumer = (exchange, roots) -> consumer
.accept(exchange, roots);
serverBuilder.rootsChangeHandler(syncConsumer);
rootsChangeConsumer.ifAvailable(consumer -> {
serverBuilder.rootsChangeHandler(consumer);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@quaff Thanks for the PR. I believe this is safer to do as the consumer type would always be BiConsumer<McpSyncServerExchange, List<McpSchema.Root>>. But, I want to double check with why it was done this way at first place. @tzolov what's your thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's copied from mcpAsyncServer method which cannot use it directly.

logger.info("Registered roots change consumer");
});

Expand Down