Class Icon
- Namespace
- ModelContextProtocol.Protocol
- Assembly
- ModelContextProtocol.Core.dll
Represents an icon that can be used to visually identify an implementation, resource, tool, or prompt.
public sealed class Icon
- Inheritance
-
Icon
- Inherited Members
Remarks
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.
Clients that support rendering icons MUST support at least the following MIME types:
- image/png - PNG images (safe, universal compatibility)
- image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
- image/svg+xml - SVG images (scalable but requires security precautions)
- image/webp - WebP images (modern, efficient format)
See the schema for details.
Properties
MimeType
Gets or sets the optional MIME type of the icon.
[JsonPropertyName("mimeType")]
public string? MimeType { get; init; }
Property Value
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".
Sizes
Gets or sets the optional size specifications for the icon.
[JsonPropertyName("sizes")]
public IList<string>? Sizes { get; init; }
Property Value
Remarks
This can specify one or more sizes at which the icon file can be used. Examples include "48x48", "any" for scalable formats like SVG.
If not provided, clients should assume that the icon can be used at any size.
Source
Gets or sets the URI pointing to the icon resource.
[JsonPropertyName("src")]
public required string Source { get; init; }
Property Value
Remarks
This can be an HTTP/HTTPS URL pointing to an image file or a data URI with base64-encoded image data.
Consumers SHOULD take steps to ensure URLs serving icons are from the same domain as the client/server or a trusted domain.
Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain executable JavaScript.
Theme
Gets or sets the optional theme for this icon.
[JsonPropertyName("theme")]
public string? Theme { get; init; }
Property Value
Remarks
Can be "light", "dark", or a custom theme identifier. Used to specify which UI theme the icon is designed for.