ExperimentalExperimental
Experimental
Creates a new task with the given creation parameters and original request. The implementation must generate a unique taskId and createdAt timestamp.
TTL Management:
The task creation parameters from the request (ttl, pollInterval)
The JSON-RPC request ID
The original request that triggered task creation
OptionalsessionId: string
Optional session ID for binding the task to a specific session
The created task object
Experimental
Gets the current status of a task.
The task identifier
OptionalsessionId: string
Optional session ID for binding the query to a specific session
The task object, or null if it does not exist
Experimental
Stores the result of a task and sets its final status.
The task identifier
The final status: 'completed' for success, 'failed' for errors
The result to store
Optional_meta?: {See MCP specification for notes on _meta usage.
OptionalprogressToken?: string | numberIf specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
Optionalio.modelcontextprotocol/related-task?: { taskId: string }If specified, this request is related to the provided task.
OptionalsessionId: string
Optional session ID for binding the operation to a specific session
Experimental
Retrieves the stored result of a task.
The task identifier
OptionalsessionId: string
Optional session ID for binding the query to a specific session
The stored result
Experimental
Updates a task's status (e.g., to 'cancelled', 'failed', 'completed').
The task identifier
The new status
OptionalstatusMessage: string
Optional diagnostic message for failed tasks or other status information
OptionalsessionId: string
Optional session ID for binding the operation to a specific session
Experimental
Lists tasks, optionally starting from a pagination cursor.
Optionalcursor: string
Optional cursor for pagination
OptionalsessionId: string
Optional session ID for binding the query to a specific session
An object containing the tasks array and an optional nextCursor
Experimental
Cleanup all timers (useful for testing or graceful shutdown)
Experimental
Get all tasks of all sessions (useful for debugging)
A simple in-memory implementation of TaskStore for demonstration purposes.
This implementation stores all tasks in memory and provides automatic cleanup based on the ttl duration specified in the task creation parameters.
A task created with a sessionId belongs to that session: calls that pass a different sessionId treat the task as not found, and listTasks with a sessionId returns that session's tasks and the tasks created without a sessionId. Calls that pass no sessionId are not restricted.
Note: This is not suitable for production use as all data is lost on restart. For production, consider implementing TaskStore with a database or distributed cache.