Interface Task

All Superinterfaces:
HasMeta
All Known Implementing Classes:
TaskEntry

@ExperimentalApi public interface Task extends HasMeta
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 Type
    Method
    Description
    boolean
    cancel(@Nullable String statusMessage)
    Requests cancellation of this task.
    boolean
    Transitions the task to the completed state.
    A future that completes when the task reaches a terminal state.
    Timestamp when this task was created.
    boolean
    Transitions the task to the failed state.
    id()
    Returns the unique task identifier.
    @Nullable Duration
    Suggested polling interval for tasks/get, or null to not suggest one.
    void
    reportProgress(double progress, @Nullable Double total, @Nullable String message)
    Reports progress for this task.
    boolean
    requireInput(InputRequest request, @Nullable String statusMessage)
    Signals that this task requires additional input from the client.
    @Nullable TaskResult
    The task result if the task has reached a terminal state, or null.
    boolean
    resume(@Nullable String statusMessage)
    Resumes a task that was waiting for input.
    Returns the current task status.
    @Nullable String
    Optional human-readable status message for this task.
    @Nullable Long
    ttl()
    Time-to-live duration after which the task is eligible for eviction, or null.
    boolean
    updateMessage(String statusMessage)
    Updates the status message of this task.

    Methods inherited from interface dev.tachyonmcp.api.server.domain.HasMeta

    meta
  • 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, or null.
    • pollInterval

      @Nullable Duration pollInterval()
      Suggested polling interval for tasks/get, or null to not suggest one.
    • result

      @Nullable TaskResult result()
      The task result if the task has reached a terminal state, or null.
    • completion

      A future that completes when the task reaches a terminal state.
    • complete

      boolean complete(TaskResult.Completed result)
      Transitions the task to the completed state.
      Parameters:
      result - the completion result
      Returns:
      true if the state transition was applied
    • fail

      boolean fail(TaskResult.Failed result)
      Transitions the task to the failed state.
      Parameters:
      result - the failure result
      Returns:
      true if the state transition was applied
    • cancel

      boolean cancel(@Nullable String statusMessage)
      Requests cancellation of this task.
      Parameters:
      statusMessage - optional cancellation reason
      Returns:
      true if the state transition was applied
    • requireInput

      boolean requireInput(InputRequest request, @Nullable String statusMessage)
      Signals that this task requires additional input from the client.
      Parameters:
      request - the input request
      statusMessage - optional status message
      Returns:
      true if the state transition was applied
    • resume

      boolean resume(@Nullable String statusMessage)
      Resumes a task that was waiting for input.
      Parameters:
      statusMessage - optional status message
      Returns:
      true if the state transition was applied
    • updateMessage

      boolean updateMessage(String statusMessage)
      Updates the status message of this task.
      Parameters:
      statusMessage - the new status message
      Returns:
      true if the message was updated
    • reportProgress

      void reportProgress(double progress, @Nullable Double total, @Nullable String message)
      Reports progress for this task.
      Parameters:
      progress - the current progress value
      total - the total expected value, or null if unknown
      message - optional progress message