From 14a4aafdc4fc227dd7a4047672d16436492a717d Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Fri, 28 Mar 2025 17:17:00 -0400 Subject: [PATCH] Add missing Annotations --- .../Protocol/Types/Annotated.cs | 16 ---------------- .../Protocol/Types/Content.cs | 6 ++++++ .../Protocol/Types/Resource.cs | 8 +++++++- .../Protocol/Types/ResourceTemplate.cs | 8 +++++++- 4 files changed, 20 insertions(+), 18 deletions(-) delete mode 100644 src/ModelContextProtocol/Protocol/Types/Annotated.cs diff --git a/src/ModelContextProtocol/Protocol/Types/Annotated.cs b/src/ModelContextProtocol/Protocol/Types/Annotated.cs deleted file mode 100644 index 3096c78c..00000000 --- a/src/ModelContextProtocol/Protocol/Types/Annotated.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Text.Json.Serialization; - -namespace ModelContextProtocol.Protocol.Types; - -/// -/// Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed. -/// See the schema for details -/// -public abstract record Annotated -{ - /// - /// Optional annotations for the resource. - /// - [JsonPropertyName("annotations")] - public Annotations? Annotations { get; init; } -} diff --git a/src/ModelContextProtocol/Protocol/Types/Content.cs b/src/ModelContextProtocol/Protocol/Types/Content.cs index 71bc475d..0fb4e135 100644 --- a/src/ModelContextProtocol/Protocol/Types/Content.cs +++ b/src/ModelContextProtocol/Protocol/Types/Content.cs @@ -39,4 +39,10 @@ public class Content /// [JsonPropertyName("resource")] public ResourceContents? Resource { get; set; } + + /// + /// Optional annotations for the content. + /// + [JsonPropertyName("annotations")] + public Annotations? Annotations { get; init; } } \ No newline at end of file diff --git a/src/ModelContextProtocol/Protocol/Types/Resource.cs b/src/ModelContextProtocol/Protocol/Types/Resource.cs index d80ac94c..249c5846 100644 --- a/src/ModelContextProtocol/Protocol/Types/Resource.cs +++ b/src/ModelContextProtocol/Protocol/Types/Resource.cs @@ -6,7 +6,7 @@ namespace ModelContextProtocol.Protocol.Types; /// Represents a known resource that the server is capable of reading. /// See the schema for details /// -public record Resource : Annotated +public record Resource { /// /// The URI of this resource. @@ -31,4 +31,10 @@ public record Resource : Annotated /// [JsonPropertyName("mimeType")] public string? MimeType { get; init; } + + /// + /// Optional annotations for the resource. + /// + [JsonPropertyName("annotations")] + public Annotations? Annotations { get; init; } } diff --git a/src/ModelContextProtocol/Protocol/Types/ResourceTemplate.cs b/src/ModelContextProtocol/Protocol/Types/ResourceTemplate.cs index 1df0c7ed..436be394 100644 --- a/src/ModelContextProtocol/Protocol/Types/ResourceTemplate.cs +++ b/src/ModelContextProtocol/Protocol/Types/ResourceTemplate.cs @@ -6,7 +6,7 @@ namespace ModelContextProtocol.Protocol.Types; /// Represents a known resource template that the server is capable of reading. /// See the schema for details /// -public record ResourceTemplate : Annotated +public record ResourceTemplate { /// /// The URI template (according to RFC 6570) that can be used to construct resource URIs. @@ -31,4 +31,10 @@ public record ResourceTemplate : Annotated /// [JsonPropertyName("mimeType")] public string? MimeType { get; init; } + + /// + /// Optional annotations for the resource template. + /// + [JsonPropertyName("annotations")] + public Annotations? Annotations { get; init; } } \ No newline at end of file