Improve progress reporting (#145)
* Improve progress reporting - Enable injecting an `IProgress<>` into a tool call to report progress when the client has supplied a progress token - Add a custom type for ProgressToken and ProgressNotification to map to the schema - Simplify RequestId to match ProgressToken's shape - Serialize StdioClientTransport's SendMessageAsync implementation - Add strongly-typed names for all request methods - Change all request IDs created by McpJsonRpcEndpoint to include a guid for that endpoint * Address PR feedback
This commit is contained in:
parent
0294c574a6
commit
2c75acded8
1 changed files with 627 additions and 228 deletions
|
|
@ -191,7 +191,7 @@ public sealed class InMemoryTestSseServer : IAsyncDisposable
|
|||
string content = await reader.ReadToEndAsync(cancellationToken);
|
||||
|
||||
var jsonRpcNotification = JsonSerializer.Deserialize<JsonRpcNotification>(content);
|
||||
if (jsonRpcNotification != null && jsonRpcNotification.Method != "initialize")
|
||||
if (jsonRpcNotification != null && jsonRpcNotification.Method != RequestMethods.Initialize)
|
||||
{
|
||||
// Test server so just ignore notifications
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ public sealed class InMemoryTestSseServer : IAsyncDisposable
|
|||
|
||||
if (jsonRpcRequest != null)
|
||||
{
|
||||
if (jsonRpcRequest.Method == "initialize")
|
||||
if (jsonRpcRequest.Method == RequestMethods.Initialize)
|
||||
{
|
||||
await HandleInitializationRequest(response, jsonRpcRequest);
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ public sealed class InMemoryTestSseServer : IAsyncDisposable
|
|||
{
|
||||
var errorResponse = new JsonRpcError
|
||||
{
|
||||
Id = id ?? RequestId.FromString("error"),
|
||||
Id = id ?? new RequestId("error"),
|
||||
JsonRpc = "2.0",
|
||||
Error = new JsonRpcErrorDetail
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue