Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 792
Implement SEP-973: Icons and metadata support for Implementations, Resources, Tools, and Prompts#802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Implement SEP-973: Icons and metadata support for Implementations, Resources, Tools, and Prompts #802
Changes from all commits
941bc0e31ad1e48b1b68424517c26c42203f666ff03ac06789e4eba38a6f6fd2e077dc6de63f54bcbe1ca25abdeae081caf37de158e423fd803e32638b40320cd7f87facca54bb762b2608cf0dc2a325245dd79aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| using System.Text.Json.Serialization; | ||
| namespace ModelContextProtocol.Protocol; | ||
| /// <summary> | ||
| /// Represents an icon that can be used to visually identify an implementation, resource, tool, or prompt. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// Icons enhance user interfaces by providing visual context and improving the discoverability of available functionality. | ||
| /// Each icon includes a source URI pointing to the icon resource, and optional MIME type and size information. | ||
| /// </para> | ||
| /// <para> | ||
| /// Clients that support rendering icons MUST support at least the following MIME types: | ||
| /// </para> | ||
| /// <list type="bullet"> | ||
| /// <item><description>image/png - PNG images (safe, universal compatibility)</description></item> | ||
| /// <item><description>image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)</description></item> | ||
| /// </list> | ||
| /// <para> | ||
| /// Clients that support rendering icons SHOULD also support: | ||
| /// </para> | ||
| /// <list type="bullet"> | ||
| /// <item><description>image/svg+xml - SVG images (scalable but requires security precautions)</description></item> | ||
| /// <item><description>image/webp - WebP images (modern, efficient format)</description></item> | ||
| /// </list> | ||
| /// <para> | ||
| /// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details. | ||
| /// </para> | ||
| /// </remarks> | ||
| public sealed class Icon | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the URI pointing to the icon resource. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// This can be an HTTP/HTTPS URL pointing to an image file or a data URI with base64-encoded image data. | ||
| /// </para> | ||
| /// <para> | ||
| /// Consumers SHOULD take steps to ensure URLs serving icons are from the same domain as the client/server | ||
| /// or a trusted domain. | ||
| /// </para> | ||
| /// <para> | ||
| /// Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain executable JavaScript. | ||
| /// </para> | ||
| /// </remarks> | ||
| [JsonPropertyName("src")] | ||
| public required string Source { get; init; } | ||
| /// <summary> | ||
| /// Gets or sets the optional MIME type of the icon. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This can be used to override the server's MIME type if it's missing or generic. | ||
| /// Common values include "image/png", "image/jpeg", "image/svg+xml", and "image/webp". | ||
| /// </remarks> | ||
| [JsonPropertyName("mimeType")] | ||
| public string? MimeType { get; init; } | ||
| /// <summary> | ||
| /// Gets or sets the optional size specifications for the icon. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// This can specify one or more sizes at which the icon file can be used. | ||
| /// Examples include "48x48", "any" for scalable formats like SVG. | ||
| /// </para> | ||
| /// <para> | ||
| /// If not provided, clients should assume that the icon can be used at any size. | ||
| /// </para> | ||
| /// </remarks> | ||
| [JsonPropertyName("sizes")] | ||
| public IList<string>? Sizes { get; init; } | ||
| /// <summary> | ||
| /// Gets or sets the optional theme for this icon. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Can be "light", "dark", or a custom theme identifier. | ||
| /// Used to specify which UI theme the icon is designed for. | ||
| /// </remarks> | ||
| [JsonPropertyName("theme")] | ||
| public string? Theme { get; init; } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -36,4 +36,28 @@ public sealed class Implementation : IBaseMetadata | ||
| /// </remarks> | ||
| [JsonPropertyName("version")] | ||
| public required string Version { get; set; } | ||
| /// <summary> | ||
| /// Gets or sets an optional list of icons for this implementation. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This can be used by clients to display the implementation's icon in a user interface. | ||
| /// </remarks> | ||
| [JsonPropertyName("icons")] | ||
| public IList<Icon>? Icons { get; set; } | ||
MackinnonBuck marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /// <summary> | ||
| /// Gets or sets an optional URL of the website for this implementation. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// <para> | ||
| /// This URL can be used by clients to link to documentation or more information about the implementation. | ||
| /// </para> | ||
| /// <para> | ||
| /// Consumers SHOULD take steps to ensure URLs are from the same domain as the client/server | ||
| /// or a trusted domain to prevent security issues. | ||
| /// </para> | ||
| /// </remarks> | ||
| [JsonPropertyName("websiteUrl")] | ||
| public string? WebsiteUrl { get; set; } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -107,6 +107,15 @@ public JsonElement? OutputSchema | ||
| [JsonPropertyName("annotations")] | ||
| public ToolAnnotations? Annotations { get; set; } | ||
| /// <summary> | ||
| /// Gets or sets an optional list of icons for this tool. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This can be used by clients to display the tool's icon in a user interface. | ||
| /// </remarks> | ||
| [JsonPropertyName("icons")] | ||
| public IList<Icon>? Icons { get; set; } | ||
MackinnonBuck marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| /// <summary> | ||
| /// Gets or sets metadata reserved by MCP for protocol-level metadata. | ||
| /// </summary> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -164,6 +164,14 @@ public sealed class McpServerToolCreateOptions | ||
| /// </remarks> | ||
| public IReadOnlyList<object>? Metadata { get; set; } | ||
| /// <summary> | ||
| /// Gets or sets the icons for this tool. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This can be used by clients to display the tool's icon in a user interface. | ||
| /// </remarks> | ||
| public IList<Icon>? Icons { get; set; } | ||
| /// <summary> | ||
| /// Creates a shallow clone of the current <see cref="McpServerToolCreateOptions"/> instance. | ||
| /// </summary> | ||
| @@ -182,5 +190,6 @@ internal McpServerToolCreateOptions Clone() => | ||
| SerializerOptions = SerializerOptions, | ||
| SchemaCreateOptions = SchemaCreateOptions, | ||
| Metadata = Metadata, | ||
| Icons = Icons, | ||
MackinnonBuck marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| }; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.