csharp-sdk/src/ModelContextProtocol/TokenProgress.cs
Tyler Kendrick 25bcb440a0
Extend progress notification support (#163)
* Extend progress notification support

* Address feedback and fix test

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2025-04-01 11:43:50 -04:00

16 lines
596 B
C#

using ModelContextProtocol.Protocol.Messages;
namespace ModelContextProtocol;
/// <summary>
/// Provides an <see cref="IProgress{ProgressNotificationValue}"/> tied to a specific progress token and that will issue
/// progress notifications on the supplied endpoint.
/// </summary>
internal sealed class TokenProgress(IMcpEndpoint endpoint, ProgressToken progressToken) : IProgress<ProgressNotificationValue>
{
/// <inheritdoc />
public void Report(ProgressNotificationValue value)
{
_ = endpoint.NotifyProgressAsync(progressToken, value, CancellationToken.None);
}
}