Table of Contents

Class McpServerPromptTypeAttribute

Namespace
ModelContextProtocol.Server
Assembly
ModelContextProtocol.dll

Used to attribute a type containing methods that should be exposed as McpServerPrompts.

[AttributeUsage(AttributeTargets.Class)]
public sealed class McpServerPromptTypeAttribute : Attribute
Inheritance
McpServerPromptTypeAttribute
Inherited Members

Remarks

This attribute is used to mark a class containing methods that should be automatically discovered and registered as McpServerPrompts. When combined with discovery methods like WithPromptsFromAssembly(IMcpServerBuilder, Assembly?, JsonSerializerOptions?), it enables automatic registration of prompts without explicitly listing each prompt class. The attribute is not necessary when a reference to the type is provided directly to a method like WithPrompts<TPromptType>(IMcpServerBuilder, JsonSerializerOptions?).

Within a class marked with this attribute, individual methods that should be exposed as prompts must be marked with the McpServerPromptAttribute.