Table of Contents

Class CancelMcpTaskResult

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents the result of a tasks/cancel request.

[Experimental("MCPEXP001", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp001")]
public sealed class CancelMcpTaskResult : Result
Inheritance
CancelMcpTaskResult
Inherited Members

Remarks

The result contains the updated task state after cancellation. The task will be in Cancelled status if the cancellation was successful.

Properties

CreatedAt

Gets or sets the ISO 8601 timestamp when the task was created.

[JsonPropertyName("createdAt")]
public required DateTimeOffset CreatedAt { get; set; }

Property Value

DateTimeOffset

LastUpdatedAt

Gets or sets the ISO 8601 timestamp when the task status was last updated.

[JsonPropertyName("lastUpdatedAt")]
public required DateTimeOffset LastUpdatedAt { get; set; }

Property Value

DateTimeOffset

PollInterval

Gets or sets the suggested time between status checks.

[JsonPropertyName("pollInterval")]
[JsonConverter(typeof(TimeSpanMillisecondsConverter))]
public TimeSpan? PollInterval { get; set; }

Property Value

TimeSpan?

Status

Gets or sets the current status of the task (should be Cancelled).

[JsonPropertyName("status")]
public required McpTaskStatus Status { get; set; }

Property Value

McpTaskStatus

StatusMessage

Gets or sets an optional message describing the cancellation.

[JsonPropertyName("statusMessage")]
public string? StatusMessage { get; set; }

Property Value

string

TaskId

Gets or sets the task ID.

[JsonPropertyName("taskId")]
public required string TaskId { get; set; }

Property Value

string

TimeToLive

Gets or sets the time to live (retention duration) from creation before the task may be deleted.

[JsonPropertyName("ttl")]
[JsonConverter(typeof(TimeSpanMillisecondsConverter))]
public TimeSpan? TimeToLive { get; set; }

Property Value

TimeSpan?