Make options types fully mutable (#107)
This commit is contained in:
parent
b61cdef994
commit
95a017a03a
1 changed files with 97 additions and 172 deletions
|
|
@ -263,25 +263,14 @@ internal sealed class McpServer : McpJsonRpcEndpoint, IMcpServer
|
|||
return tool.InvokeAsync(request, cancellationToken);
|
||||
};
|
||||
|
||||
toolsCapability = toolsCapability is null ?
|
||||
new()
|
||||
{
|
||||
CallToolHandler = callToolHandler,
|
||||
ListToolsHandler = listToolsHandler,
|
||||
ToolCollection = tools,
|
||||
ListChanged = true,
|
||||
} :
|
||||
toolsCapability with
|
||||
{
|
||||
CallToolHandler = callToolHandler,
|
||||
ListToolsHandler = listToolsHandler,
|
||||
ToolCollection = tools,
|
||||
ListChanged = true,
|
||||
};
|
||||
toolsCapability ??= new();
|
||||
toolsCapability.CallToolHandler = callToolHandler;
|
||||
toolsCapability.ListToolsHandler = listToolsHandler;
|
||||
toolsCapability.ToolCollection = tools;
|
||||
toolsCapability.ListChanged = true;
|
||||
|
||||
options.Capabilities = options.Capabilities is null ?
|
||||
new() { Tools = toolsCapability } :
|
||||
options.Capabilities with { Tools = toolsCapability };
|
||||
options.Capabilities ??= new();
|
||||
options.Capabilities.Tools = toolsCapability;
|
||||
|
||||
tools.Changed += delegate
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue