csharp-sdk/src/ModelContextProtocol.Core/TokenProgress.cs
2025-06-02 15:16:45 -07:00

16 lines
587 B
C#

using ModelContextProtocol.Protocol;
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);
}
}