Class TaskEntry
java.lang.Object
dev.tachyonmcp.core.server.features.tasks.TaskEntry
- All Implemented Interfaces:
HasMeta,Task,ServerFeature<TaskDescriptor>
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.tachyonmcp.api.server.ServerFeature
ServerFeature.Descriptor, ServerFeature.Request -
Constructor Summary
ConstructorsConstructorDescriptionTaskEntry(TaskDescriptor descriptor, String id, TaskState status, double ttl) TaskEntry(TaskDescriptor descriptor, String id, TaskState status, double ttl, @Nullable String sessionId) TaskEntry(TaskDescriptor descriptor, String id, TaskState status, @Nullable Duration ttl, @Nullable String sessionId, @Nullable ProgressToken progressToken) TaskEntry(TaskDescriptor descriptor, String id, TaskState status, @Nullable Duration ttl, @Nullable String sessionId, @Nullable ProgressToken progressToken, @Nullable Map<String, Object> meta) TaskEntry(TaskDescriptor descriptor, String id, TaskState status, @Nullable Duration ttl, @Nullable String sessionId, @Nullable ProgressToken progressToken, @Nullable Map<String, Object> meta, Duration keepAlive) TaskEntry(TaskDescriptor descriptor, String id, TaskState status, @Nullable Duration ttl, @Nullable String sessionId, @Nullable ProgressToken progressToken, @Nullable Map<String, Object> meta, Duration keepAlive, @Nullable Duration pollInterval) -
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.longReturns the metadata descriptor for this feature.booleanfail(TaskResult.Failed result) Transitions the task to the failed state.id()Returns the unique task identifier.booleanbooleanWhether this task's result has outlived itskeepAliveretention window.How long after this task reaches a terminal state its result stays retrievable.longmeta()Returns the optional metadata map for protocol extensions.@Nullable DurationSuggested polling interval fortasks/get, ornullto not suggest one.@Nullable ProgressTokenvoidreportProgress(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.@Nullable StringbooleanResumes a task that was waiting for input.@Nullable StringThe session that created this task, ornullfor programmatic/server-global tasks.status()Returns the current task status.@Nullable StringOptional human-readable status message for this task.booleantransitionTo(TaskState newStatus) Transitions tonewStatuswithout a result value.booleantransitionTo(TaskState newStatus, @Nullable TaskResult result) Transitions tonewStatus, publishingresult(when non-null).@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.
-
Constructor Details
-
TaskEntry
-
TaskEntry
public TaskEntry(TaskDescriptor descriptor, String id, TaskState status, double ttl, @Nullable String sessionId) -
TaskEntry
public TaskEntry(TaskDescriptor descriptor, String id, TaskState status, @Nullable Duration ttl, @Nullable String sessionId, @Nullable ProgressToken progressToken) -
TaskEntry
public TaskEntry(TaskDescriptor descriptor, String id, TaskState status, @Nullable Duration ttl, @Nullable String sessionId, @Nullable ProgressToken progressToken, @Nullable Map<String, Object> meta) -
TaskEntry
public TaskEntry(TaskDescriptor descriptor, String id, TaskState status, @Nullable Duration ttl, @Nullable String sessionId, @Nullable ProgressToken progressToken, @Nullable Map<String, Object> meta, Duration keepAlive) -
TaskEntry
-
-
Method Details
-
sessionId
The session that created this task, ornullfor programmatic/server-global tasks. -
progressToken
-
meta
Description copied from interface:HasMetaReturns the optional metadata map for protocol extensions. -
descriptor
Description copied from interface:ServerFeatureReturns the metadata descriptor for this feature.- Specified by:
descriptorin interfaceServerFeature<TaskDescriptor>- Returns:
- the descriptor
-
id
Description copied from interface:TaskReturns the unique task identifier. -
status
Description copied from interface:TaskReturns the current task status. -
statusMessage
Description copied from interface:TaskOptional human-readable status message for this task.- Specified by:
statusMessagein interfaceTask
-
createdAt
Description copied from interface:TaskTimestamp when this task was created. -
ttl
Description copied from interface:TaskTime-to-live duration after which the task is eligible for eviction, ornull. -
keepAlive
How long after this task reaches a terminal state its result stays retrievable. -
pollInterval
Description copied from interface:TaskSuggested polling interval fortasks/get, ornullto not suggest one.- Specified by:
pollIntervalin interfaceTask
-
result
Description copied from interface:TaskThe task result if the task has reached a terminal state, ornull. -
completion
Description copied from interface:TaskA future that completes when the task reaches a terminal state.- Specified by:
completionin interfaceTask
-
complete
Description copied from interface:TaskTransitions the task to the completed state. -
fail
Description copied from interface:TaskTransitions the task to the failed state. -
cancel
Description copied from interface:TaskRequests cancellation of this task. -
requireInput
Description copied from interface:TaskSignals that this task requires additional input from the client.- Specified by:
requireInputin interfaceTask- Parameters:
request- the input requeststatusMessage- optional status message- Returns:
trueif the state transition was applied
-
resume
Description copied from interface:TaskResumes a task that was waiting for input. -
updateMessage
Description copied from interface:TaskUpdates the status message of this task.- Specified by:
updateMessagein interfaceTask- Parameters:
statusMessage- the new status message- Returns:
trueif the message was updated
-
reportProgress
Description copied from interface:TaskReports progress for this task.- Specified by:
reportProgressin interfaceTask- Parameters:
progress- the current progress valuetotal- the total expected value, ornullif unknownmessage- optional progress message
-
createdAtMillis
public long createdAtMillis() -
lastUpdatedAt
public long lastUpdatedAt() -
resultJson
-
transitionTo
Transitions tonewStatuswithout a result value. -
transitionTo
Transitions tonewStatus, publishingresult(when non-null). -
isExpired
public boolean isExpired() -
isResultExpired
public boolean isResultExpired()Whether this task's result has outlived itskeepAliveretention window. -
createdAtIso
-
lastUpdatedAtIso
-