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:
Stephen Toub 2025-03-31 09:33:16 -04:00 • committed by GitHub
commit 2c75acded8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,7 +26,7 @@ public static class McpServerExtensions
}
return server.SendRequestAsync<CreateMessageResult>(
new JsonRpcRequest { Method = "sampling/createMessage", Params = request },
new JsonRpcRequest { Method = RequestMethods.SamplingCreateMessage, Params = request },
cancellationToken);
}
@ -165,7 +165,7 @@ public static class McpServerExtensions
}
return server.SendRequestAsync<ListRootsResult>(
new JsonRpcRequest { Method = "roots/list", Params = request },
new JsonRpcRequest { Method = RequestMethods.RootsList, Params = request },
cancellationToken);
}