Add ModelContextProtocol.Core package (#428)
This commit is contained in:
parent
57458241b9
commit
703b0fe50b
1 changed files with 239 additions and 94 deletions
16
src/ModelContextProtocol.Core/TokenProgress.cs
Normal file
16
src/ModelContextProtocol.Core/TokenProgress.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue