{
  "schema_version": "1.3.0",
  "slug": "what-happens-when-an-instance-replays-a-streamable-http-mcp-tool-call-across-a-reconnect-and-the-server-has-no-idempotency-key-to-deduplicate-it",
  "title": "What happens when an instance replays a Streamable HTTP MCP tool call across a reconnect and the server has no idempotency key to deduplicate it",
  "date_of_record": "2026 December 2",
  "scope": "Applies to MCP clients using the Streamable HTTP transport with resumable SSE streams and `Last-Event-ID` replay, where tool calls carry side effects (writes, sends, payments) and the server-side tool handler is not itself idempotent. Does not apply to stateless request/response transports without replay, nor to tool calls that are provably read-only.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-streamable-http-mcp-tool-call-across-a-reconnect-and-the-server-has-no-idempotency-key-to-deduplicate-it.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-streamable-http-mcp-tool-call-across-a-reconnect-and-the-server-has-no-idempotency-key-to-deduplicate-it.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/what-happens-when-an-instance-replays-a-streamable-http-mcp-tool-call-across-a-reconnect-and-the-server-has-no-idempotency-key-to-deduplicate-it.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1807,
    "python_slice_tokens": 336,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"the connection dropped.\" Connections drop constantly and the transport is *designed* to survive that. The failure is the mismatch between two independent guarantees that operators routinely conflate: 1. **Transport-level at-least-once delivery.** Streamable HTTP with `Last-Event-ID` resume guarantees that an event the client never acknowl...",
    "what_was_observed": "A write-capable MCP server exposed a `create_ticket` tool. The client (an agent runtime) issued `tools/call` as a POST that opened an SSE stream. The server executed the tool, emitted a `progress` event, then a `result` event with the new ticket ID, and the client consumed the result and emitted `Last-Event-ID: 42` on the next request. The break sequence: - Server processed `create_ticket`, committed the row (ticket ...",
    "condition_of_validity": "The invariant only holds — that is, exactly-once tool effects survive reconnect — when **all** of the following are true simultaneously: - The client supplies a stable idempotency key per logical tool call, generated *before* the first send and persisted across checkpoint/resume, not regenerated on retry. - The server's tool handler performs a dedup check on...",
    "decision_boundary": "The boundary the agent runtime must decide, on every reconnect, is: **do I have enough durable state to make this replay safe, or must I refuse and escalate?** - If the persisted idempotency key exists *and* the server is known to dedup on it → replay is safe; re-send with the same key. - If the key exists but the server's dedup behavior is unknown or unvers...",
    "operational_effect": "Without the guardrail, the operational effect is silent duplication proportional to reconnect frequency: every mid-stream failure during a side-effecting call produces one extra effect. Under flaky networks or rolling deploys this compounds, and because each duplicate looks like a clean success in the agent transcript, it is invisible to observability built ..."
  },
  "matched_failure_symptoms": [
    "DUPLICATE_MUTATION_OR_BILLING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "d0cb6949b6c07f1aeecf3bf0a9ece24db3db9c494521ac9c6aae1dadf08bead6",
    "verified_classes": [
      "ReplaySafetyError",
      "ToolCallState"
    ],
    "verified_functions": [
      "make_idempotency_key",
      "plan_reconnect",
      "resume_call"
    ],
    "verified_functions_count": 3,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "ReplaySafetyError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
