Resource subscribe should be true if handler provided (#676)
Co-authored-by: Stephen Halter <halter73@gmail.com> Co-authored-by: Mike Kistler <mikekistler@microsoft.com>
This commit is contained in:
parent
31f8d20a1a
commit
9bbae84c9b
1 changed files with 18 additions and 42 deletions
|
|
@ -97,13 +97,14 @@ internal sealed class McpServerOptionsSetup(
|
|||
optionsHandlers.ListResourceTemplatesHandler = handlers.ListResourceTemplatesHandler ?? optionsHandlers.ListResourceTemplatesHandler;
|
||||
optionsHandlers.ListResourcesHandler = handlers.ListResourcesHandler ?? optionsHandlers.ListResourcesHandler;
|
||||
optionsHandlers.ReadResourceHandler = handlers.ReadResourceHandler ?? optionsHandlers.ReadResourceHandler;
|
||||
}
|
||||
|
||||
if (handlers.SubscribeToResourcesHandler is not null || handlers.UnsubscribeFromResourcesHandler is not null)
|
||||
{
|
||||
optionsHandlers.SubscribeToResourcesHandler = handlers.SubscribeToResourcesHandler ?? optionsHandlers.SubscribeToResourcesHandler;
|
||||
optionsHandlers.UnsubscribeFromResourcesHandler = handlers.UnsubscribeFromResourcesHandler ?? optionsHandlers.UnsubscribeFromResourcesHandler;
|
||||
resourcesCapability.Subscribe = true;
|
||||
}
|
||||
if (handlers.SubscribeToResourcesHandler is not null || handlers.UnsubscribeFromResourcesHandler is not null)
|
||||
{
|
||||
resourcesCapability ??= new();
|
||||
optionsHandlers.SubscribeToResourcesHandler = handlers.SubscribeToResourcesHandler ?? optionsHandlers.SubscribeToResourcesHandler;
|
||||
optionsHandlers.UnsubscribeFromResourcesHandler = handlers.UnsubscribeFromResourcesHandler ?? optionsHandlers.UnsubscribeFromResourcesHandler;
|
||||
resourcesCapability.Subscribe = true;
|
||||
}
|
||||
|
||||
ToolsCapability? toolsCapability = options.Capabilities?.Tools;
|
||||
|
|
|
|||
Loading…
Reference in a new issue