The operations.py module#
Summary#
Join, shield and replay mutating tool calls for one server. |
Return the identity of a call: tool name plus its JSON-serializable arguments. |
Seconds a finished idempotent result stays available to an identical retry. |
Description#
Make long-running mutating tool calls survive host timeouts.
Component activation, case loading and solver runs often outlast an MCP host’s
request timeout. The host then cancels the call and usually retries, which
interrupts the work and starts it a second time. CallCoordinator:
shields the running work from client cancellation so it completes;
lets a retry with identical arguments join the call that is still running;
replays, once and within
replay_ttl_s, the result of an idempotent call that finished after the host gave up. Any other mutating call clears the replay cache, so a replay never hides a state change made in between.
Nothing is ever undone.
Module detail#
- operations.call_key(tool: str, kwargs: dict[str, Any]) tuple[str, str]#
Return the identity of a call: tool name plus its JSON-serializable arguments.
Arguments that cannot be serialized (for example an injected request context) are left out, so they never make identical calls look different.
- operations.REPLAY_TTL_S = 300.0#
Seconds a finished idempotent result stays available to an identical retry.