Add server "completions" capability (#232)
* Split apart Capabilities.cs No code changes, just moving each type to its own file. * Add server completions capability
This commit is contained in:
parent
ac0bc3a1f1
commit
82510d5629
1 changed files with 321 additions and 272 deletions
42
src/ModelContextProtocol/Protocol/Types/ToolsCapability.cs
Normal file
42
src/ModelContextProtocol/Protocol/Types/ToolsCapability.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using ModelContextProtocol.Protocol.Messages;
|
||||
using ModelContextProtocol.Server;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ModelContextProtocol.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the tools capability configuration.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class ToolsCapability
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets whether this server supports notifications for changes to the tool list.
|
||||
/// </summary>
|
||||
[JsonPropertyName("listChanged")]
|
||||
public bool? ListChanged { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the handler for list tools requests.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Func<RequestContext<ListToolsRequestParams>, CancellationToken, Task<ListToolsResult>>? ListToolsHandler { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the handler for call tool requests.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Func<RequestContext<CallToolRequestParams>, CancellationToken, Task<CallToolResponse>>? CallToolHandler { get; set; }
|
||||
|
||||
/// <summary>Gets or sets a collection of tools served by the server.</summary>
|
||||
/// <remarks>
|
||||
/// Tools will specified via <see cref="ToolCollection"/> augment the <see cref="ListToolsHandler"/> and
|
||||
/// <see cref="CallToolHandler"/>, if provided. ListTools requests will output information about every tool
|
||||
/// in <see cref="ToolCollection"/> and then also any tools output by <see cref="ListToolsHandler"/>, if it's
|
||||
/// non-<see langword="null"/>. CallTool requests will first check <see cref="ToolCollection"/> for the tool
|
||||
/// being requested, and if the tool is not found in the <see cref="ToolCollection"/>, any specified <see cref="CallToolHandler"/>
|
||||
/// will be invoked as a fallback.
|
||||
/// </remarks>
|
||||
[JsonIgnore]
|
||||
public McpServerPrimitiveCollection<McpServerTool>? ToolCollection { get; set; }
|
||||
}
|
||||
Loading…
Reference in a new issue