Commit d01918a
committed
Rework the Tasks extension: tasks are recorded at completion
A task record is now created only when the tool call has produced its
outcome, and the store is a pluggable async protocol:
- An input_required interim passes through un-augmented; only the leg
that completes the call becomes a task, so a multi round-trip exchange
yields exactly one task. An error (a raised MCPError, or ErrorData
returned by a nested interceptor) propagates as the JSON-RPC error the
client is waiting on instead of stranding a half-created task.
- tasks/cancel acknowledges without rewriting terminal status: the tool
has always finished by the time a tasks/* request can arrive, and
SEP-2663's cooperative cancellation permits an ack without effect.
- The missing-capability error uses mcp_types' -32021 constant via
require_client_extension, replacing the stale -32003 numeral SEP-2663's
prose still carries from before the error-code renumber.
- tasks/update is served as the SEP-required acknowledgement; unknown
inputResponses keys are ignored, absent inputResponses is rejected.
- tasks/* bindings are version-scoped to the modern wire, so legacy
clients get METHOD_NOT_FOUND instead of a capability error they could
never satisfy on that wire.
- The default clock is a real UTC wallclock; clocks return datetimes and
wire formatting lives in one place.
- TaskStore is an async protocol (Tasks(store=...)) with an in-memory
default that enforces ttlMs (expired records drop on access and are
swept on insert); stored results are copied at both boundaries; ttlMs
stays on the wire when null (required-but-nullable in the extension
schema); non-positive default_ttl_ms is rejected at construction.1 parent 9f166f6 commit d01918a
2 files changed
Lines changed: 728 additions & 161 deletions
0 commit comments