Class McpServerResourceTypeAttribute
- Namespace
- ModelContextProtocol.Server
- Assembly
- ModelContextProtocol.Core.dll
Used to attribute a type containing members that should be exposed as McpServerResources.
[AttributeUsage(AttributeTargets.Class)]
public sealed class McpServerResourceTypeAttribute : Attribute
- Inheritance
-
McpServerResourceTypeAttribute
- Inherited Members
Remarks
This attribute is used to mark a class containing members that should be automatically discovered and registered as McpServerResources. When combined with discovery methods like WithResourcesFromAssembly, it enables automatic registration of resources without explicitly listing each resource class. The attribute is not necessary when a reference to the type is provided directly to a method like McpServerBuilderExtensions.WithResources.
Within a class marked with this attribute, individual members that should be exposed as resources must be marked with the McpServerResourceAttribute.