Add middleware and authz support for server-side handlers (#733)
This commit is contained in:
parent
0f0aad020b
commit
d344c65120
1 changed files with 2871 additions and 435 deletions
|
|
@ -13,10 +13,10 @@ public sealed class ToolsCapability
|
|||
/// Gets or sets whether this server supports notifications for changes to the tool list.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When set to <see langword="true"/>, the server will send notifications using
|
||||
/// <see cref="NotificationMethods.ToolListChangedNotification"/> when tools are added,
|
||||
/// When set to <see langword="true"/>, the server will send notifications using
|
||||
/// <see cref="NotificationMethods.ToolListChangedNotification"/> when tools are added,
|
||||
/// removed, or modified. Clients can register handlers for these notifications to
|
||||
/// refresh their tool cache. This capability enables clients to stay synchronized with server-side
|
||||
/// refresh their tool cache. This capability enables clients to stay synchronized with server-side
|
||||
/// changes to available tools.
|
||||
/// </remarks>
|
||||
[JsonPropertyName("listChanged")]
|
||||
|
|
@ -33,19 +33,19 @@ public sealed class ToolsCapability
|
|||
/// and the tools from the collection will be combined to form the complete list of available tools.
|
||||
/// </remarks>
|
||||
[JsonIgnore]
|
||||
public Func<RequestContext<ListToolsRequestParams>, CancellationToken, ValueTask<ListToolsResult>>? ListToolsHandler { get; set; }
|
||||
public McpRequestHandler<ListToolsRequestParams, ListToolsResult>? ListToolsHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the handler for <see cref="RequestMethods.ToolsCall"/> requests.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This handler is invoked when a client makes a call to a tool that isn't found in the <see cref="ToolCollection"/>.
|
||||
/// The handler should implement logic to execute the requested tool and return appropriate results.
|
||||
/// It receives a <see cref="RequestContext{CallToolRequestParams}"/> containing information about the tool
|
||||
/// The handler should implement logic to execute the requested tool and return appropriate results.
|
||||
/// It receives a <see cref="RequestContext{CallToolRequestParams}"/> containing information about the tool
|
||||
/// being called and its arguments, and should return a <see cref="CallToolResult"/> with the execution results.
|
||||
/// </remarks>
|
||||
[JsonIgnore]
|
||||
public Func<RequestContext<CallToolRequestParams>, CancellationToken, ValueTask<CallToolResult>>? CallToolHandler { get; set; }
|
||||
public McpRequestHandler<CallToolRequestParams, CallToolResult>? CallToolHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a collection of tools served by the server.
|
||||
|
|
|
|||
Loading…
Reference in a new issue