using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Json.Serialization; namespace ModelContextProtocol.Protocol; /// /// Represents the result returned by a server when it creates a task in lieu of a standard result. /// /// /// /// A server returns instead of the standard result shape (e.g., ) /// to indicate that the request will be processed asynchronously. The client then uses /// for subsequent tasks/get, tasks/update, and tasks/cancel calls. /// /// /// A server must not return to a client that did not include the /// io.modelcontextprotocol/tasks extension capability on its request. /// /// /// See the SEP-2663 /// specification for details. /// /// public sealed class CreateTaskResult : Result { /// /// Gets or sets the stable identifier for this task. /// [JsonPropertyName("taskId")] public required string TaskId { get; set; } /// /// Gets or sets the current task status. /// [JsonPropertyName("status")] public required McpTaskStatus Status { get; set; } /// /// Gets or sets an optional message describing the current task state. /// [JsonPropertyName("statusMessage")] public string? StatusMessage { get; set; } /// /// Gets or sets the ISO 8601 timestamp when the task was created. /// [JsonPropertyName("createdAt")] public required DateTimeOffset CreatedAt { get; set; } /// /// Gets or sets the ISO 8601 timestamp when the task was last updated. /// [JsonPropertyName("lastUpdatedAt")] public required DateTimeOffset LastUpdatedAt { get; set; } /// /// Gets or sets the time-to-live duration from creation, or for unlimited. /// [JsonPropertyName("ttlMs")] [JsonConverter(typeof(TimeSpanMillisecondsConverter))] public TimeSpan? TimeToLive { get; set; } /// /// Gets or sets the suggested polling interval in milliseconds. /// [JsonPropertyName("pollIntervalMs")] public long? PollIntervalMs { get; set; } }