Table of Contents

Class CancelMcpTaskRequestParams

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Represents the parameters for a tasks/cancel request to explicitly cancel a task.

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

Remarks

Receivers must reject cancellation requests for tasks already in a terminal status (Completed, Failed, or Cancelled) with error code -32602 (Invalid params).

Upon receiving a valid cancellation request, receivers should attempt to stop the task execution and must transition the task to Cancelled status before sending the response.

Properties

TaskId

Gets or sets the unique identifier of the task to cancel.

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

Property Value

string