Overhaul McpClientFactory/McpServerFactory (#87)
Handlers are now specified before connecting the client/server. Otherwise, race conditions exist. Handlers move into being a part of the McpClientOptions/McpServerOptions, so that they're provided to the factories. Where relevant, the handlers are specified as part of the capability descriptors, so that they go hand in hand. The factories are no longer stateful. Instead of allocating a factory and then calling a create method on it, you just call a static factory method.
This commit is contained in:
parent
63b24a4036
commit
08b0a04dab
1 changed files with 1306 additions and 2243 deletions
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
using McpDotNet.Protocol.Types;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace McpDotNet.Server;
|
||||
|
||||
|
|
@ -34,4 +35,10 @@ public record McpServerOptions
|
|||
/// Optional server instructions to send to clients
|
||||
/// </summary>
|
||||
public string ServerInstructions { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the handler for get completion requests.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public Func<RequestContext<CompleteRequestParams>, CancellationToken, Task<CompleteResult>>? GetCompletionHandler { get; init; }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue