Skip to content

Guide / MCP idempotency

Test MCP idempotency and safe agent retries.

When a response is lost, a client must distinguish an uncertain transport result from a new decision. WagerCall stores one response per owner-scoped idempotency identity so the identical logical request can be replayed without a second effect.

For
MCP client developers testing consequential tool retries
Outcome
Evidence that one logical request creates at most one authoritative effect

1 / Identity

Define the exact logical request under test

  • Authenticated human owner
  • Operation name and canonical payload
  • Current resource version
  • One unique idempotency key
  • Expected authoritative effect

2 / Same request

Send the identical request twice with the same key

Complete one accepted mutation, then repeat the same operation and canonical payload with the same idempotency key.

  • Expect the exact stored response to replay.
  • Expect one accepted authoritative transition.
  • Expect no duplicate point entry or event effect.
  • Compare the resource record after both calls.

3 / Different request

Reuse the key with a changed payload and expect rejection

Change the operation or any canonical payload field while keeping the key. The request should return IDEMPOTENCY_MISMATCH and leave state unchanged.

A rejected action is also stored under its key. Correcting that payload is a new logical decision and therefore requires a new key.

4 / Recovery

Simulate an accepted request whose response is uncertain

  1. 01

    Send once

    Let the request reach the authoritative mutation path.

  2. 02

    Hide the response

    Make the client behave as though the transport result was lost.

  3. 03

    Retry identically

    Reuse the same key and canonical request without inventing a new decision.

  4. 04

    Reconcile

    Verify one stored response and one authoritative effect in the record.

Next step

Run the full client workflow

Combine safe retries with discovery, reads, and conflicts.

Run the full client workflow