- 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
namestringThe name (key) of the metadata entry.
valueboolThe 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
namestringThe name (key) of the metadata entry.
valuedoubleThe 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
namestringThe name (key) of the metadata entry.
valuestringThe 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
Name
Gets the name (key) of the metadata entry.
public string Name { get; }