Add server "completions" capability (#232)

* Split apart Capabilities.cs

No code changes, just moving each type to its own file.

* Add server completions capability
This commit is contained in:
Stephen Toub 2025-04-07 16:59:37 -04:00 • committed by GitHub
commit 82510d5629
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -288,15 +288,15 @@ public static partial class McpServerBuilderExtensions
}
/// <summary>
/// Sets the handler for get completion requests.
/// Sets the handler for completion complete requests.
/// </summary>
/// <param name="builder">The builder instance.</param>
/// <param name="handler">The handler.</param>
public static IMcpServerBuilder WithGetCompletionHandler(this IMcpServerBuilder builder, Func<RequestContext<CompleteRequestParams>, CancellationToken, Task<CompleteResult>> handler)
public static IMcpServerBuilder WithCompleteHandler(this IMcpServerBuilder builder, Func<RequestContext<CompleteRequestParams>, CancellationToken, Task<CompleteResult>> handler)
{
Throw.IfNull(builder);
builder.Services.Configure<McpServerHandlers>(s => s.GetCompletionHandler = handler);
builder.Services.Configure<McpServerHandlers>(s => s.CompleteHandler = handler);
return builder;
}