Closed
Description
Is your feature request related to a problem? Please describe.
Similar to #70.
The API for McpToolType
and McpTool
(combined with the WithTools
method) makes it really easy to define tools. It'd be great to have a comparable API for Resources.
Describe the solution you'd like
I'd like to be able to have code like this:
[ResourceType]
public static class SampleResource {
[Resource("text/plain"), Description("This is a sample resource")]
public static string Sample() => "test://static/resource/sample.txt";
}
// in program.cs
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithTools()
.WithResources();
Describe alternatives you've considered
Currently, the only solution would be to implement this via WithListResourcesHandler
and WithReadResourceHandler
.