Initial commit
This commit is contained in:
commit
fdbd94b3f9
1 changed files with 2833 additions and 0 deletions
84
src/mcpdotnet/Protocol/Types/Resources.cs
Normal file
84
src/mcpdotnet/Protocol/Types/Resources.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
namespace McpDotNet.Protocol.Types;
|
||||
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a known resource that the server is capable of reading.
|
||||
/// </summary>
|
||||
public record Resource
|
||||
{
|
||||
/// <summary>
|
||||
/// The URI of this resource.
|
||||
/// </summary>
|
||||
[JsonPropertyName("uri")]
|
||||
public required string Uri { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// A human-readable name for this resource.
|
||||
/// </summary>
|
||||
[JsonPropertyName("name")]
|
||||
public required string Name { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// A description of what this resource represents.
|
||||
/// </summary>
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The MIME type of this resource, if known.
|
||||
/// </summary>
|
||||
[JsonPropertyName("mimeType")]
|
||||
public string? MimeType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional annotations for the resource.
|
||||
/// </summary>
|
||||
[JsonPropertyName("annotations")]
|
||||
public Annotations? Annotations { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interface for resource contents.
|
||||
/// </summary>
|
||||
public interface IResourceContents
|
||||
{
|
||||
string Uri { get; }
|
||||
string? MimeType { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents text-based resource contents.
|
||||
/// </summary>
|
||||
public record TextResourceContents : IResourceContents
|
||||
{
|
||||
[JsonPropertyName("uri")]
|
||||
public required string Uri { get; init; }
|
||||
|
||||
[JsonPropertyName("mimeType")]
|
||||
public string? MimeType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The text content of the resource.
|
||||
/// </summary>
|
||||
[JsonPropertyName("text")]
|
||||
public required string Text { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents binary resource contents.
|
||||
/// </summary>
|
||||
public record BlobResourceContents : IResourceContents
|
||||
{
|
||||
[JsonPropertyName("uri")]
|
||||
public required string Uri { get; init; }
|
||||
|
||||
[JsonPropertyName("mimeType")]
|
||||
public string? MimeType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The base64-encoded binary content of the resource.
|
||||
/// </summary>
|
||||
[JsonPropertyName("blob")]
|
||||
public required string Blob { get; init; }
|
||||
}
|
||||
Loading…
Reference in a new issue