Class ResourceTemplate | MCP C# SDK

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents a known resource template that the server is capable of reading.

public sealed class ResourceTemplate : IBaseMetadata
Inheritance

ResourceTemplate

Implements
Inherited Members

Properties

Annotations

Gets or sets optional annotations for the resource template.

[JsonPropertyName("annotations")]
public Annotations? Annotations { get; set; }

Property Value

Annotations

Description

Gets or sets a description of what this resource template represents.

[JsonPropertyName("description")]
public string? Description { get; set; }

Property Value

string

Icons

Gets or sets an optional list of icons for this resource template.

[JsonPropertyName("icons")]
public IList<Icon>? Icons { get; set; }

Property Value

IList<Icon>

IsTemplated

Gets a value that indicates whether UriTemplate contains any template expressions.

[JsonIgnore]
public bool IsTemplated { get; }

Property Value

bool

Meta

Gets or sets metadata reserved by MCP for protocol-level metadata.

[JsonPropertyName("_meta")]
public JsonObject? Meta { get; set; }

Property Value

JsonObject

MimeType

Gets or sets the MIME type of this resource template, if known.

[JsonPropertyName("mimeType")]
public string? MimeType { get; set; }

Property Value

string

Name

Gets or sets the unique identifier for this item.

[JsonPropertyName("name")]
public required string Name { get; set; }

Property Value

string

Title

Gets or sets a title.

[JsonPropertyName("title")]
public string? Title { get; set; }

Property Value

string

UriTemplate

Gets or sets the URI template (according to RFC 6570) that can be used to construct resource URIs.

[JsonPropertyName("uriTemplate")]
public required string UriTemplate { get; set; }

Property Value

string

Methods

AsResource()

public Resource? AsResource()

Returns

Resource

A Resource if IsTemplated is false; otherwise, null.