Package dev.tachyonmcp.api.server.domain
Interface Task
- All Superinterfaces:
HasMeta
- All Known Implementing Classes:
TaskEntry
Represents an async task that may complete, fail, require input, or report progress.
Task-augmented tool calls produce a handle that tracks the operation lifecycle.
The caller polls tasks/get or subscribes to notifications to observe state
transitions.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanRequests cancellation of this task.booleancomplete(TaskResult.Completed result) Transitions the task to the completed state.A future that completes when the task reaches a terminal state.Timestamp when this task was created.booleanfail(TaskResult.Failed result) Transitions the task to the failed state.id()Returns the unique task identifier.@Nullable DurationSuggested polling interval fortasks/get, ornullto not suggest one.voidreportProgress(double progress, @Nullable Double total, @Nullable String message) Reports progress for this task.booleanrequireInput(InputRequest request, @Nullable String statusMessage) Signals that this task requires additional input from the client.@Nullable TaskResultresult()The task result if the task has reached a terminal state, ornull.booleanResumes a task that was waiting for input.status()Returns the current task status.@Nullable StringOptional human-readable status message for this task.@Nullable Longttl()Time-to-live duration after which the task is eligible for eviction, ornull.booleanupdateMessage(String statusMessage) Updates the status message of this task.
-
Method Details
-
id
String id()Returns the unique task identifier. -
status
TaskState status()Returns the current task status. -
statusMessage
@Nullable String statusMessage()Optional human-readable status message for this task. -
createdAt
Instant createdAt()Timestamp when this task was created. -
ttl
@Nullable Long ttl()Time-to-live duration after which the task is eligible for eviction, ornull. -
pollInterval
@Nullable Duration pollInterval()Suggested polling interval fortasks/get, ornullto not suggest one. -
result
@Nullable TaskResult result()The task result if the task has reached a terminal state, ornull. -
completion
CompletionStage<TaskResult> completion()A future that completes when the task reaches a terminal state. -
complete
Transitions the task to the completed state.- Parameters:
result- the completion result- Returns:
trueif the state transition was applied
-
fail
Transitions the task to the failed state.- Parameters:
result- the failure result- Returns:
trueif the state transition was applied
-
cancel
Requests cancellation of this task.- Parameters:
statusMessage- optional cancellation reason- Returns:
trueif the state transition was applied
-
requireInput
Signals that this task requires additional input from the client.- Parameters:
request- the input requeststatusMessage- optional status message- Returns:
trueif the state transition was applied
-
resume
Resumes a task that was waiting for input.- Parameters:
statusMessage- optional status message- Returns:
trueif the state transition was applied
-
updateMessage
Updates the status message of this task.- Parameters:
statusMessage- the new status message- Returns:
trueif the message was updated
-
reportProgress
Reports progress for this task.- Parameters:
progress- the current progress valuetotal- the total expected value, ornullif unknownmessage- optional progress message
-