TaskStorage

interface TaskStorage(source)

Pluggable storage interface for MCP tasks. Implementations can provide in-memory, database, or other persistence strategies. All operations are scoped by session - tasks are isolated between sessions.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class TaskPage(val tasks: List<Task>, val nextCursor: Cursor? = null)

Functions

Link copied to clipboard
abstract fun delete(session: Session, taskId: TaskId)

Delete a task by ID for a session.

Link copied to clipboard
abstract fun get(session: Session, taskId: TaskId): Task?

Retrieve a task by ID for a session. Returns null if not found, expired, or belongs to different session.

Link copied to clipboard
abstract fun list(session: Session, cursor: Cursor? = null): TaskStorage.TaskPage

List all tasks for a session with optional pagination.

Link copied to clipboard
abstract fun remove(session: Session)

Remove all tasks and results for a session. Called when session closes.

Link copied to clipboard
abstract fun resultFor(session: Session, taskId: TaskId): Map<String, Any>?

Retrieve the result payload for a task in a session.

Link copied to clipboard
abstract fun store(session: Session, task: Task)

Store a new task or update an existing task for a session.

Link copied to clipboard
abstract fun storeResult(session: Session, taskId: TaskId, result: Map<String, Any>)

Store the result payload for a completed task in a session.