parent
85cefc23ff
commit
c9ace236a0
23 changed files with 864 additions and 274 deletions
12
src/mcpdotnet/Protocol/Messages/IJsonRpcMessage.cs
Normal file
12
src/mcpdotnet/Protocol/Messages/IJsonRpcMessage.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for all JSON-RPC messages in the MCP protocol.
|
||||
/// </summary>
|
||||
public interface IJsonRpcMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Must be "2.0".
|
||||
/// </summary>
|
||||
string JsonRpc { get; }
|
||||
}
|
||||
12
src/mcpdotnet/Protocol/Messages/IJsonRpcMessageWithId.cs
Normal file
12
src/mcpdotnet/Protocol/Messages/IJsonRpcMessageWithId.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for JSON-RPC messages that include an ID.
|
||||
/// </summary>
|
||||
public interface IJsonRpcMessageWithId : IJsonRpcMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// The message identifier.
|
||||
/// </summary>
|
||||
RequestId Id { get; }
|
||||
}
|
||||
27
src/mcpdotnet/Protocol/Messages/JsonRpcError.cs
Normal file
27
src/mcpdotnet/Protocol/Messages/JsonRpcError.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// An error response message in the JSON-RPC protocol.
|
||||
/// </summary>
|
||||
public record JsonRpcError : IJsonRpcMessageWithId
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Always "2.0".
|
||||
/// </summary>
|
||||
[JsonPropertyName("jsonrpc")]
|
||||
public string JsonRpc { get; init; } = "2.0";
|
||||
|
||||
/// <summary>
|
||||
/// Request identifier matching the original request.
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public required RequestId Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Error information.
|
||||
/// </summary>
|
||||
[JsonPropertyName("error")]
|
||||
public required JsonRpcErrorDetail Error { get; init; }
|
||||
}
|
||||
27
src/mcpdotnet/Protocol/Messages/JsonRpcErrorDetail.cs
Normal file
27
src/mcpdotnet/Protocol/Messages/JsonRpcErrorDetail.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Detailed error information for JSON-RPC error responses.
|
||||
/// </summary>
|
||||
public record JsonRpcErrorDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// Integer error code.
|
||||
/// </summary>
|
||||
[JsonPropertyName("code")]
|
||||
public required int Code { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Short description of the error.
|
||||
/// </summary>
|
||||
[JsonPropertyName("message")]
|
||||
public required string Message { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional additional error data.
|
||||
/// </summary>
|
||||
[JsonPropertyName("data")]
|
||||
public object? Data { get; init; }
|
||||
}
|
||||
|
|
@ -2,28 +2,6 @@
|
|||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for all JSON-RPC messages in the MCP protocol.
|
||||
/// </summary>
|
||||
public interface IJsonRpcMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Must be "2.0".
|
||||
/// </summary>
|
||||
string JsonRpc { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for JSON-RPC messages that include an ID.
|
||||
/// </summary>
|
||||
public interface IJsonRpcMessageWithId : IJsonRpcMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// The message identifier.
|
||||
/// </summary>
|
||||
RequestId Id { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A request message in the JSON-RPC protocol.
|
||||
/// </summary>
|
||||
|
|
@ -53,99 +31,3 @@ public record JsonRpcRequest : IJsonRpcMessageWithId
|
|||
[JsonPropertyName("params")]
|
||||
public object? Params { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A notification message in the JSON-RPC protocol (a request that doesn't expect a response).
|
||||
/// </summary>
|
||||
public record JsonRpcNotification : IJsonRpcMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Always "2.0".
|
||||
/// </summary>
|
||||
[JsonPropertyName("jsonrpc")]
|
||||
public string JsonRpc { get; init; } = "2.0";
|
||||
|
||||
/// <summary>
|
||||
/// Name of the notification method.
|
||||
/// </summary>
|
||||
[JsonPropertyName("method")]
|
||||
public required string Method { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional parameters for the notification.
|
||||
/// </summary>
|
||||
[JsonPropertyName("params")]
|
||||
public object? Params { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A successful response message in the JSON-RPC protocol.
|
||||
/// </summary>
|
||||
public record JsonRpcResponse : IJsonRpcMessageWithId
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Always "2.0".
|
||||
/// </summary>
|
||||
[JsonPropertyName("jsonrpc")]
|
||||
public string JsonRpc { get; init; } = "2.0";
|
||||
|
||||
/// <summary>
|
||||
/// Request identifier matching the original request.
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public required RequestId Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The result of the method invocation.
|
||||
/// </summary>
|
||||
[JsonPropertyName("result")]
|
||||
public required object Result { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An error response message in the JSON-RPC protocol.
|
||||
/// </summary>
|
||||
public record JsonRpcError : IJsonRpcMessageWithId
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Always "2.0".
|
||||
/// </summary>
|
||||
[JsonPropertyName("jsonrpc")]
|
||||
public string JsonRpc { get; init; } = "2.0";
|
||||
|
||||
/// <summary>
|
||||
/// Request identifier matching the original request.
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public required RequestId Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Error information.
|
||||
/// </summary>
|
||||
[JsonPropertyName("error")]
|
||||
public required JsonRpcErrorDetail Error { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detailed error information for JSON-RPC error responses.
|
||||
/// </summary>
|
||||
public record JsonRpcErrorDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// Integer error code.
|
||||
/// </summary>
|
||||
[JsonPropertyName("code")]
|
||||
public required int Code { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Short description of the error.
|
||||
/// </summary>
|
||||
[JsonPropertyName("message")]
|
||||
public required string Message { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional additional error data.
|
||||
/// </summary>
|
||||
[JsonPropertyName("data")]
|
||||
public object? Data { get; init; }
|
||||
}
|
||||
27
src/mcpdotnet/Protocol/Messages/JsonRpcNotification.cs
Normal file
27
src/mcpdotnet/Protocol/Messages/JsonRpcNotification.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// A notification message in the JSON-RPC protocol (a request that doesn't expect a response).
|
||||
/// </summary>
|
||||
public record JsonRpcNotification : IJsonRpcMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Always "2.0".
|
||||
/// </summary>
|
||||
[JsonPropertyName("jsonrpc")]
|
||||
public string JsonRpc { get; init; } = "2.0";
|
||||
|
||||
/// <summary>
|
||||
/// Name of the notification method.
|
||||
/// </summary>
|
||||
[JsonPropertyName("method")]
|
||||
public required string Method { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional parameters for the notification.
|
||||
/// </summary>
|
||||
[JsonPropertyName("params")]
|
||||
public object? Params { get; init; }
|
||||
}
|
||||
27
src/mcpdotnet/Protocol/Messages/JsonRpcResponse.cs
Normal file
27
src/mcpdotnet/Protocol/Messages/JsonRpcResponse.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// A successful response message in the JSON-RPC protocol.
|
||||
/// </summary>
|
||||
public record JsonRpcResponse : IJsonRpcMessageWithId
|
||||
{
|
||||
/// <summary>
|
||||
/// JSON-RPC protocol version. Always "2.0".
|
||||
/// </summary>
|
||||
[JsonPropertyName("jsonrpc")]
|
||||
public string JsonRpc { get; init; } = "2.0";
|
||||
|
||||
/// <summary>
|
||||
/// Request identifier matching the original request.
|
||||
/// </summary>
|
||||
[JsonPropertyName("id")]
|
||||
public required RequestId Id { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The result of the method invocation.
|
||||
/// </summary>
|
||||
[JsonPropertyName("result")]
|
||||
public required object Result { get; init; }
|
||||
}
|
||||
27
src/mcpdotnet/Protocol/Messages/NotificationMethods.cs
Normal file
27
src/mcpdotnet/Protocol/Messages/NotificationMethods.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// A class containing constants for notification methods.
|
||||
/// </summary>
|
||||
public static class NotificationMethods
|
||||
{
|
||||
/// <summary>
|
||||
/// Sent by the server when the list of tools changes.
|
||||
/// </summary>
|
||||
public const string ToolListChangedNotification = "notifications/tools/list_changed";
|
||||
|
||||
/// <summary>
|
||||
/// Sent by the server when the list of prompts changes.
|
||||
/// </summary>
|
||||
public const string PromptsListChanged = "notifications/prompts/list_changed";
|
||||
|
||||
/// <summary>
|
||||
/// Sent by the server when the list of resources changes.
|
||||
/// </summary>
|
||||
public const string ResourceListChangedNotification = "notifications/resources/list_changed";
|
||||
|
||||
/// <summary>
|
||||
/// Sent by the server when a resource is updated.
|
||||
/// </summary>
|
||||
public const string ResourceUpdatedNotification = "notifications/resources/updated";
|
||||
}
|
||||
12
src/mcpdotnet/Protocol/Messages/PaginatedResult.cs
Normal file
12
src/mcpdotnet/Protocol/Messages/PaginatedResult.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
namespace McpDotNet.Protocol.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// A paginated result payload.
|
||||
/// </summary>
|
||||
public class PaginatedResult
|
||||
{
|
||||
/// <summary>
|
||||
/// An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.
|
||||
/// </summary>
|
||||
public string? NextCursor { get; set; }
|
||||
}
|
||||
|
|
@ -18,4 +18,5 @@ public record BlobResourceContents : IResourceContents
|
|||
/// </summary>
|
||||
[JsonPropertyName("blob")]
|
||||
public required string Blob { get; init; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class CallToolResponse
|
|||
/// <summary>
|
||||
/// The server's response to a tools/call request from the client.
|
||||
/// </summary>
|
||||
public List<ToolContent> Content { get; set; } = new();
|
||||
public List<Content> Content { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Whether the tool call was unsuccessful. If true, the call was unsuccessful.
|
||||
|
|
|
|||
|
|
@ -1,97 +1,58 @@
|
|||
// Protocol/Types/Content.cs
|
||||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the type of role in the conversation.
|
||||
/// Represents the content of a tool response.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">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 enum Role
|
||||
{
|
||||
[JsonPropertyName("user")]
|
||||
User,
|
||||
|
||||
[JsonPropertyName("assistant")]
|
||||
Assistant
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for content types in messages.
|
||||
/// </summary>
|
||||
public interface IContent
|
||||
{
|
||||
string Type { get; }
|
||||
Annotations? Annotations { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents text content in messages.
|
||||
/// </summary>
|
||||
public record TextContent : IContent
|
||||
public class Content
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of content. Always "text".
|
||||
/// The type of content. This determines the structure of the content object. Can be "image", "text", "resource".
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
public string Type => "text";
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The text content of the message.
|
||||
/// </summary>
|
||||
[JsonPropertyName("text")]
|
||||
public required string Text { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional annotations for the content.
|
||||
/// </summary>
|
||||
[JsonPropertyName("annotations")]
|
||||
public Annotations? Annotations { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents image content in messages.
|
||||
/// </summary>
|
||||
public record ImageContent : IContent
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of content. Always "image".
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
public string Type => "image";
|
||||
public string? Text { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The base64-encoded image data.
|
||||
/// </summary>
|
||||
[JsonPropertyName("data")]
|
||||
public required string Data { get; init; }
|
||||
public string? Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The MIME type of the image.
|
||||
/// </summary>
|
||||
[JsonPropertyName("mimeType")]
|
||||
public required string MimeType { get; init; }
|
||||
public string? MimeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional annotations for the content.
|
||||
/// One of BlobResourceContents or TextResourceContents.
|
||||
/// </summary>
|
||||
[JsonPropertyName("annotations")]
|
||||
public Annotations? Annotations { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents annotations that can be attached to content.
|
||||
/// </summary>
|
||||
public record Annotations
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes who the intended customer of this object or data is.
|
||||
/// </summary>
|
||||
[JsonPropertyName("audience")]
|
||||
public Role[]? Audience { get; init; }
|
||||
public object? Resource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Describes how important this data is for operating the server (0 to 1).
|
||||
/// Validates the content object.
|
||||
/// </summary>
|
||||
[JsonPropertyName("priority")]
|
||||
public float? Priority { get; init; }
|
||||
}
|
||||
/// <returns>Whether the type of tool content has the correct data fields provided.</returns>
|
||||
public bool Validate()
|
||||
{
|
||||
if (Type == "text")
|
||||
{
|
||||
return !string.IsNullOrEmpty(Text);
|
||||
}
|
||||
else if (Type == "image")
|
||||
{
|
||||
return !string.IsNullOrEmpty(Data) && !string.IsNullOrEmpty(MimeType);
|
||||
}
|
||||
else if (Type == "resource")
|
||||
{
|
||||
return Resource is BlobResourceContents || Resource is TextResourceContents;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
src/mcpdotnet/Protocol/Types/GetPromptResult.cs
Normal file
18
src/mcpdotnet/Protocol/Types/GetPromptResult.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// The server's response to a prompts/get request from the client.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class GetPromptResult
|
||||
{
|
||||
/// <summary>
|
||||
/// An optional description for the prompt.
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The prompt or prompt template that the server offers.
|
||||
/// </summary>
|
||||
public List<PromptMessage> Messages { get; set; } = new();
|
||||
}
|
||||
97
src/mcpdotnet/Protocol/Types/IContent.cs
Normal file
97
src/mcpdotnet/Protocol/Types/IContent.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
// Protocol/Types/Content.cs
|
||||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the type of role in the conversation.
|
||||
/// </summary>
|
||||
public enum Role
|
||||
{
|
||||
[JsonPropertyName("user")]
|
||||
User,
|
||||
|
||||
[JsonPropertyName("assistant")]
|
||||
Assistant
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for content types in messages.
|
||||
/// </summary>
|
||||
public interface IContent
|
||||
{
|
||||
string Type { get; }
|
||||
Annotations? Annotations { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents text content in messages.
|
||||
/// </summary>
|
||||
public record TextContent : IContent
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of content. Always "text".
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
public string Type => "text";
|
||||
|
||||
/// <summary>
|
||||
/// The text content of the message.
|
||||
/// </summary>
|
||||
[JsonPropertyName("text")]
|
||||
public required string Text { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional annotations for the content.
|
||||
/// </summary>
|
||||
[JsonPropertyName("annotations")]
|
||||
public Annotations? Annotations { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents image content in messages.
|
||||
/// </summary>
|
||||
public record ImageContent : IContent
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of content. Always "image".
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
public string Type => "image";
|
||||
|
||||
/// <summary>
|
||||
/// The base64-encoded image data.
|
||||
/// </summary>
|
||||
[JsonPropertyName("data")]
|
||||
public required string Data { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The MIME type of the image.
|
||||
/// </summary>
|
||||
[JsonPropertyName("mimeType")]
|
||||
public required string MimeType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional annotations for the content.
|
||||
/// </summary>
|
||||
[JsonPropertyName("annotations")]
|
||||
public Annotations? Annotations { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents annotations that can be attached to content.
|
||||
/// </summary>
|
||||
public record Annotations
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes who the intended customer of this object or data is.
|
||||
/// </summary>
|
||||
[JsonPropertyName("audience")]
|
||||
public Role[]? Audience { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Describes how important this data is for operating the server (0 to 1).
|
||||
/// </summary>
|
||||
[JsonPropertyName("priority")]
|
||||
public float? Priority { get; init; }
|
||||
}
|
||||
15
src/mcpdotnet/Protocol/Types/ListPromptsResult.cs
Normal file
15
src/mcpdotnet/Protocol/Types/ListPromptsResult.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using McpDotNet.Protocol.Messages;
|
||||
|
||||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// The server's response to a prompts/list request from the client.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class ListPromptsResult : PaginatedResult
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of prompts or prompt templates that the server offers.
|
||||
/// </summary>
|
||||
public List<Prompt> Prompts { get; set; } = new();
|
||||
}
|
||||
15
src/mcpdotnet/Protocol/Types/ListResourcesResult.cs
Normal file
15
src/mcpdotnet/Protocol/Types/ListResourcesResult.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using McpDotNet.Protocol.Messages;
|
||||
|
||||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// The server's response to a resources/list request from the client.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class ListResourcesResult : PaginatedResult
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of resources that the server offers.
|
||||
/// </summary>
|
||||
public List<Resource> Resources { get; set; } = new();
|
||||
}
|
||||
15
src/mcpdotnet/Protocol/Types/ListToolsResult.cs
Normal file
15
src/mcpdotnet/Protocol/Types/ListToolsResult.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using McpDotNet.Protocol.Messages;
|
||||
|
||||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// A response to a request to list the tools available on the server.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class ListToolsResult : PaginatedResult
|
||||
{
|
||||
/// <summary>
|
||||
/// The server's response to a tools/list request from the client.
|
||||
/// </summary>
|
||||
public List<Tool> Tools { get; set; } = new();
|
||||
}
|
||||
23
src/mcpdotnet/Protocol/Types/Prompt.cs
Normal file
23
src/mcpdotnet/Protocol/Types/Prompt.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// A prompt or prompt template that the server offers.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class Prompt
|
||||
{
|
||||
/// <summary>
|
||||
/// A list of arguments to use for templating the prompt.
|
||||
/// </summary>
|
||||
public List<PromptArgument>? Arguments { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An optional description of what this prompt provides
|
||||
/// </summary>
|
||||
public string? Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the prompt or prompt template.
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
23
src/mcpdotnet/Protocol/Types/PromptArgument.cs
Normal file
23
src/mcpdotnet/Protocol/Types/PromptArgument.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Describes an argument that a prompt can accept.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class PromptArgument
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the argument.
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A human-readable description of the argument.
|
||||
/// </summary>
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this argument must be provided.
|
||||
/// </summary>
|
||||
public bool? Required { get; set; }
|
||||
}
|
||||
21
src/mcpdotnet/Protocol/Types/PromptMessage.cs
Normal file
21
src/mcpdotnet/Protocol/Types/PromptMessage.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
/// <summary>
|
||||
/// Describes a message returned as part of a prompt.
|
||||
///
|
||||
/// This is similar to `SamplingMessage`, but also supports the embedding of
|
||||
/// resources from the MCP server.
|
||||
/// <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/schema.json">See the schema for details</see>
|
||||
/// </summary>
|
||||
public class PromptMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// The content of the message. Any of TextContent, ImageContent, EmbeddedResource.
|
||||
/// </summary>
|
||||
public Content Content { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The role of the message ("user" or "assistant").
|
||||
/// </summary>
|
||||
public Role Role { get; set; } = new();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue