using System.Diagnostics.CodeAnalysis; using System.Text.Json.Serialization; namespace ModelContextProtocol.Protocol; /// /// Represents the status of an MCP task. /// /// /// /// Tasks progress through a defined lifecycle: /// /// : The request is currently being processed. /// : The receiver needs input from the requestor. /// The requestor should call tasks/result to receive input requests. /// : The request completed successfully and results are available. /// : The request did not complete successfully. /// : The request was cancelled before completion. /// /// /// /// Terminal states are , , and . /// Once a task reaches a terminal state, it cannot transition to any other status. /// /// [JsonConverter(typeof(JsonStringEnumConverter))] [Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)] public enum McpTaskStatus { /// /// The request is currently being processed. /// /// /// Tasks begin in this status when created. From , tasks may transition /// to , , , or . /// [JsonStringEnumMemberName("working")] Working, /// /// The receiver needs input from the requestor. /// /// /// The requestor should call tasks/result to receive input requests, even though the task /// has not reached a terminal state. From , tasks may transition /// to , , , or . /// [JsonStringEnumMemberName("input_required")] InputRequired, /// /// The request completed successfully and results are available. /// /// /// This is a terminal status. Tasks in this status cannot transition to any other status. /// [JsonStringEnumMemberName("completed")] Completed, /// /// The associated request did not complete successfully. /// /// /// This is a terminal status. For tool calls specifically, this includes cases where /// the tool call result has isError set to true. Tasks in this status cannot transition /// to any other status. /// [JsonStringEnumMemberName("failed")] Failed, /// /// The request was cancelled before completion. /// /// /// This is a terminal status. Tasks in this status cannot transition to any other status. /// [JsonStringEnumMemberName("cancelled")] Cancelled }