Implement cancellation notifications (#146)

* Implement cancellation notifications

* Address PR feedback

* Address feedback
This commit is contained in:
Stephen Toub 2025-03-31 12:09:47 -04:00 • committed by GitHub
commit 8fe96bf6ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,21 @@
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol.Messages;
/// <summary>
/// This notification indicates that the result will be unused, so any associated processing SHOULD cease.
/// </summary>
public sealed class CancelledNotification
{
/// <summary>
/// The ID of the request to cancel.
/// </summary>
[JsonPropertyName("requestId")]
public RequestId RequestId { get; set; }
/// <summary>
/// An optional string describing the reason for the cancellation.
/// </summary>
[JsonPropertyName("reason")]
public string? Reason { get; set; }
}