Class McpTask

java.lang.Object
com.soklet.McpTask

@ThreadSafe public final class McpTask extends Object
Immutable authoritative snapshot of one MCP task.

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