Class McpMetaAttribute | MCP C# SDK

Namespace
ModelContextProtocol.Server
Assembly
ModelContextProtocol.Core.dll

Specifies metadata for an MCP server primitive (tool, prompt, or resource).

[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class McpMetaAttribute : Attribute
Inheritance

McpMetaAttribute

Inherited Members

Examples

[McpServerTool]
[McpMeta("model", "gpt-4o")]
[McpMeta("version", "1.0")]
[McpMeta("priority", 5.0)]
[McpMeta("isBeta", true)]
[McpMeta("tags", JsonValue = """["a","b"]""")]
public string MyTool(string input) => $"Processed: {input}";

Constructors

McpMetaAttribute(string, bool)

Initializes a new instance of the McpMetaAttribute class with a Boolean value.

public McpMetaAttribute(string name, bool value)

Parameters

name string

The name (key) of the metadata entry.

value bool

The Boolean value of the metadata entry.

McpMetaAttribute(string, double)

Initializes a new instance of the McpMetaAttribute class with a double value.

public McpMetaAttribute(string name, double value)

Parameters

name string

The name (key) of the metadata entry.

value double

The double value of the metadata entry.

McpMetaAttribute(string, string?)

Initializes a new instance of the McpMetaAttribute class with a string value.

public McpMetaAttribute(string name, string? value = null)

Parameters

name string

The name (key) of the metadata entry.

value string

The string value of the metadata entry. If null, the value will be serialized as JSON null.

Properties

JsonValue

Gets or sets the value of the metadata entry as a JSON string.

[StringSyntax("Json")]
public string JsonValue { get; set; }

Property Value

string

Name

Gets the name (key) of the metadata entry.

public string Name { get; }

Property Value

string