Add initial support for Resource Templates (#18)
* Add initial support for Resource Templates * Make ListResourceTemplatesHandler not required The server was throwing if this handler wasn't specified, and it should probably be optional anyway. * Remove extra line Co-authored-by: Stephen Toub <stoub@microsoft.com> * Fix spaces Co-authored-by: Stephen Toub <stoub@microsoft.com> * Fix spaces Co-authored-by: Stephen Toub <stoub@microsoft.com> * Add and use a default ListResourceTemplatesHandler If no ListResourceTemplatesHandler is specified, use a default one that returns an empty result. * Fix spaces * Spaces * Add Client extensions for ListResourceTemplates * Integration Test for Client ListResourceTemplates * Fix comment Co-authored-by: Stephen Toub <stoub@microsoft.com> * Make Defaults internal Co-authored-by: Stephen Toub <stoub@microsoft.com> * Simplify test call Co-authored-by: Stephen Toub <stoub@microsoft.com> * Make delegate static Co-authored-by: Stephen Toub <stoub@microsoft.com> * Fix test comment * Spaces * Fix xml doc Co-authored-by: Stephen Toub <stoub@microsoft.com> * Make default handler inline * Spaces Co-authored-by: Stephen Halter <halter73@gmail.com> --------- Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
parent
50cc48830e
commit
fe6b401014
1 changed files with 287 additions and 3 deletions
|
|
@ -71,6 +71,19 @@ public class McpServerBuilderExtensionsHandlerTests
|
|||
Assert.Equal(handler, options.GetPromptHandler);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WithListResourceTemplatesHandler_Sets_Handler()
|
||||
{
|
||||
Func<RequestContext<ListResourceTemplatesRequestParams>, CancellationToken, Task<ListResourceTemplatesResult>> handler = (context, token) => Task.FromResult(new ListResourceTemplatesResult());
|
||||
|
||||
_builder.Object.WithListResourceTemplatesHandler(handler);
|
||||
|
||||
var serviceProvider = _services.BuildServiceProvider();
|
||||
var options = serviceProvider.GetRequiredService<IOptions<McpServerHandlers>>().Value;
|
||||
|
||||
Assert.Equal(handler, options.ListResourceTemplatesHandler);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WithListResourcesHandler_Sets_Handler()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue