using System.Text.Json.Nodes; using System.Text.Json.Serialization; namespace ModelContextProtocol.Protocol; /// /// Represents a known resource that the server is capable of reading. /// /// /// See the schema for details. /// public sealed class Resource : IBaseMetadata { /// [JsonPropertyName("name")] public required string Name { get; set; } /// [JsonPropertyName("title")] public string? Title { get; set; } /// /// Gets or sets the URI of this resource. /// [JsonPropertyName("uri")] public required string Uri { get; init; } /// /// Gets or sets a description of what this resource represents. /// /// /// /// This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a \"hint\" to the model. /// /// /// The description should provide clear context about the resource's content, format, and purpose. /// This helps AI models make better decisions about when to access or reference the resource. /// /// /// Client applications can also use this description for display purposes in user interfaces /// or to help users understand the available resources. /// /// [JsonPropertyName("description")] public string? Description { get; init; } /// /// Gets or sets the MIME type of this resource. /// /// /// /// specifies the format of the resource content, helping clients to properly interpret and display the data. /// Common MIME types include "text/plain" for plain text, "application/pdf" for PDF documents, /// "image/png" for PNG images, and "application/json" for JSON data. /// /// /// This property may be if the MIME type is unknown or not applicable for the resource. /// /// [JsonPropertyName("mimeType")] public string? MimeType { get; init; } /// /// Gets or sets optional annotations for the resource. /// /// /// These annotations can be used to specify the intended audience (, , or both) /// and the priority level of the resource. Clients can use this information to filter or prioritize resources for different roles. /// [JsonPropertyName("annotations")] public Annotations? Annotations { get; init; } /// /// Gets or sets the size of the raw resource content (before base64 encoding), in bytes, if known. /// /// /// This can be used by applications to display file sizes and estimate context window usage. /// [JsonPropertyName("size")] public long? Size { get; init; } /// /// Gets or sets metadata reserved by MCP for protocol-level metadata. /// /// /// Implementations must not make assumptions about its contents. /// [JsonPropertyName("_meta")] public JsonObject? Meta { get; init; } }