Add ToolAnnotations support (#124)
* Add ToolAnnotations support * Address feedback
This commit is contained in:
parent
2c1672cc1a
commit
62e92fa154
55 changed files with 645 additions and 394 deletions
|
|
@ -25,7 +25,7 @@ public sealed class StdioServerTransport : TransportBase, IServerTransport
|
|||
private readonly TextReader _stdInReader;
|
||||
private readonly Stream _stdOutStream;
|
||||
|
||||
private SemaphoreSlim _sendLock = new(1, 1);
|
||||
private readonly SemaphoreSlim _sendLock = new(1, 1);
|
||||
private Task? _readTask;
|
||||
private CancellationTokenSource? _shutdownCts;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public abstract record Annotated
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Represents annotations that can be attached to content.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public record Annotations
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Used for completion requests to provide additional context for the completion options.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class Argument
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/// <summary>
|
||||
/// Used by the client to invoke a tool provided by the server.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class CallToolRequestParams : RequestParams
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
/// However, any errors in _finding_ the tool, an error indicating that the
|
||||
/// server does not support tool calls, or any other exceptional conditions,
|
||||
/// should be reported as an MCP error response.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class CallToolResponse
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Represents the capabilities that a client may support.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class ClientCapabilities
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ public class ClientCapabilities
|
|||
|
||||
/// <summary>
|
||||
/// Represents the roots capability configuration.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class RootsCapability
|
||||
{
|
||||
|
|
@ -47,7 +47,7 @@ public class RootsCapability
|
|||
|
||||
/// <summary>
|
||||
/// Represents the sampling capability configuration.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class SamplingCapability
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ public class SamplingCapability
|
|||
|
||||
/// <summary>
|
||||
/// Represents the logging capability configuration.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class LoggingCapability
|
||||
{
|
||||
|
|
@ -76,7 +76,7 @@ public class LoggingCapability
|
|||
|
||||
/// <summary>
|
||||
/// Represents the prompts capability configuration.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class PromptsCapability
|
||||
{
|
||||
|
|
@ -101,7 +101,7 @@ public class PromptsCapability
|
|||
|
||||
/// <summary>
|
||||
/// Represents the resources capability configuration.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class ResourcesCapability
|
||||
{
|
||||
|
|
@ -150,7 +150,7 @@ public class ResourcesCapability
|
|||
|
||||
/// <summary>
|
||||
/// Represents the tools capability configuration.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class ToolsCapability
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/// <summary>
|
||||
/// A request from the client to the server, to ask for completion options.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class CompleteRequestParams : RequestParams
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// The server's response to a completion/complete request
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class CompleteResult
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Represents a completion object in the server's response
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class Completion
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Represents the content of a tool response.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// There are multiple subtypes of content, depending on the "type" field, these are represented as separate classes.
|
||||
/// </summary>
|
||||
public class Content
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of content. This determines the structure of the content object. Can be "image", "text", "resource".
|
||||
/// The type of content. This determines the structure of the content object. Can be "image", "audio", "text", "resource".
|
||||
/// </summary>
|
||||
|
||||
[JsonPropertyName("type")]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// A request to include context from one or more MCP servers (including the caller), to be attached to the prompt.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(JsonStringEnumConverter<ContextInclusion>))]
|
||||
public enum ContextInclusion
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
///
|
||||
/// While these align with the protocol specification,
|
||||
/// clients have full discretion over model selection and should inform users before sampling.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class CreateMessageRequestParams : RequestParams
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
/// The client's response to a sampling/create_message request from the server.
|
||||
/// The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop)
|
||||
/// and decide whether to allow the server to see it.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class CreateMessageResult
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/// <summary>
|
||||
/// An empty result object.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class EmptyResult
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/// <summary>
|
||||
/// Used by the client to get a prompt provided by the server.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class GetPromptRequestParams : RequestParams
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/// <summary>
|
||||
/// The server's response to a prompts/get request from the client.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class GetPromptResult
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Describes the name and version of an MCP implementation.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class Implementation
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Parameters for an initialization request sent to the server.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class InitializeRequestParams : RequestParams
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace ModelContextProtocol.Protocol.Types;
|
|||
|
||||
/// <summary>
|
||||
/// Result of the initialization request sent to the server.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/2024-11-05/schema.json">See the schema for details</see>
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">See the schema for details</see>
|
||||
/// </summary>
|
||||
public record InitializeResult
|
||||
{
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue