Class McpTask
The configured McpTaskManager returns this value after atomically
authorizing the current request. The origin is application-persisted
framework data and is never rendered on the wire. Task status determines
the one permitted status-specific payload: outstanding input requests for
McpTaskStatus.INPUT_REQUIRED, a complete result for
McpTaskStatus.COMPLETED, or a JSON-RPC failure for
McpTaskStatus.FAILED. A tool result whose isError value is
true is still a completed task.
This value does not contain task ownership or an authorization decision. A manager must independently bind the task to the admitted principal, tenant, endpoint, and other application authorization context, and must not return a snapshot to an unauthorized request.
Construction validates the status-specific payload shape, not whether
that payload can be delivered under the origin tool's contract. Soklet
checks outstanding input declarations and completed output during delivery,
using the current server's access policy and result sanitizer. A failed
delivery does not change this authoritative snapshot or synthesize a
McpTaskStatus.FAILED state.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder for an immutable task snapshot. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the operation result of a completed task.Returns the JSON-RPC error that failed task execution.Returns outstanding task input requests in insertion order.Returns the non-wire origin persisted with this task.Returns the duration after creation for which the task may be retained.inthashCode()toString()static @NonNull McpTask.BuilderwithTaskId(@NonNull String taskId, @NonNull McpTaskOrigin taskOrigin, @NonNull McpTaskStatus taskStatus, @NonNull Instant createdAt, @NonNull Instant lastUpdatedAt) Vends a builder primed with every required task property.
-
Method Details
-
withTaskId
public static @NonNull McpTask.Builder withTaskId(@NonNull String taskId, @NonNull McpTaskOrigin taskOrigin, @NonNull McpTaskStatus taskStatus, @NonNull Instant createdAt, @NonNull Instant lastUpdatedAt) Vends a builder primed with every required task property.- Parameters:
taskId- nonblank task identifier without carriage-return or newline characterstaskOrigin- persisted framework origintaskStatus- current task statuscreatedAt- task creation timelastUpdatedAt- most recent state-update time, not before creation- Returns:
- task builder
- Throws:
NullPointerException- if an argument is nullIllegalArgumentException- if the task ID or timestamps are invalid
-
getTaskId
-
getTaskOrigin
Returns the non-wire origin persisted with this task.- Returns:
- framework-derived task origin
-
getTaskStatus
- Returns:
- current task status
-
getTaskStatusMessage
- Returns:
- client-visible status message, if supplied
-
getCreatedAt
- Returns:
- task creation time
-
getLastUpdatedAt
- Returns:
- most recent task state-update time
-
getTimeToLive
Returns the duration after creation for which the task may be retained.- Returns:
- positive whole-millisecond duration, or empty for unlimited
-
getPollInterval
- Returns:
- positive whole-millisecond suggested polling interval, if any
-
getInputRequests
Returns outstanding task input requests in insertion order.- Returns:
- immutable input-request map; nonempty only for
McpTaskStatus.INPUT_REQUIRED
-
getCompletedResult
Returns the operation result of a completed task.- Returns:
- complete result only for
McpTaskStatus.COMPLETED
-
getFailure
Returns the JSON-RPC error that failed task execution.- Returns:
- failure only for
McpTaskStatus.FAILED
-
getMetadata
- Returns:
- immutable task-result protocol extension metadata
-
equals
-
hashCode
-
toString
-