McpTaskStore class
The receiver's tasks.
Constructors
- McpTaskStore({Duration maxTtl = const Duration(hours: 1), Duration defaultTtl = const Duration(minutes: 10), Duration pollInterval = const Duration(seconds: 1), int maxTasksPerOwner = 100})
Properties
-
changes
→ Stream<
McpTaskRecord> -
Every status change.
no setter
- defaultTtl → Duration
-
Retention when the requestor names none.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxTasksPerOwner → int
-
Live (non-terminal) tasks one authorization context may hold.
final
- maxTtl → Duration
-
The longest retention granted, whatever is requested.
final
- pollInterval → Duration
-
Suggested polling interval.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
acceptInput(
McpTaskRecord task, Map< String, dynamic> responses) → Map<String, dynamic> -
Extension: take the responses to outstanding keys (others are ignored);
once none are outstanding the task is
workingagain. Returns the accepted responses. -
cancel(
McpTaskRecord task, {String? statusMessage}) → bool -
Cancel
task; false when it is already terminal. -
close(
) → Future< void> -
complete(
McpTaskRecord task, Map< String, dynamic> result, {String? statusMessage}) → bool -
Record the underlying request's result. For the core specification a
tool result with
isError: trueis a failure; for the extension it is a completion (failure is reserved for JSON-RPC errors). -
create(
{required String? owner, required McpTaskFlavor flavor, required String method, int? requestedTtlMs, DateTime? now}) → McpTaskRecord -
Create a
workingtask. The id is 128 random bits from a secure source, so it cannot be guessed even where no owner binds it. -
fail(
McpTaskRecord task, Map< String, dynamic> error, {String? statusMessage}) → bool - Record the underlying request's JSON-RPC error.
-
get(
String? taskId, {required String? owner, DateTime? now}) → McpTaskRecord? -
The task
taskIdasownermay see it: null when it does not exist, has expired, or belongs to another authorization context. -
list(
{required String? owner, DateTime? now}) → List< McpTaskRecord> -
owner's tasks, oldest first. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
purgeExpired(
{DateTime? now}) → void - Drop expired tasks.
-
requireInput(
McpTaskRecord task, Map< String, Map< requests) → voidString, dynamic> > - Extension: ask the client for input. Keys must never have been issued for this task before.
-
toString(
) → String -
A string representation of this object.
inherited
-
transition(
McpTaskRecord task, String status, {String? statusMessage, DateTime? now}) → bool -
Move
tasktostatus; false (and no change) when the lifecycle does not allow it — a terminal task never changes again.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited