- One agent, six calls
Sent to payments@vendor.example
The call goes to the mail server and the result is kept for 10 minutes under its arguments.
Three steps to the gate
First, clone and build. Node 22 or newer.
Then name the tools that change the world: side effects, approval, attempt limits.
Last, give your MCP client the gateway instead of the servers behind it. Tools appear as server__tool.
What it keeps
Loop stop
The same call three times in a row is refused.

A gate on the road
Holloway turnpike, engraving. CC0
tollgate.lock.json
"mail__send_email": { "hash": "9f2c…" },
"crm__delete_contact": { "hash": "41ab…" }Tool lockfile
A tool whose description or schema changed is hidden until a person locks it again.

Every call on record
Third Massachusetts Turnpike certificate, 1797. CC0
Attempt limit
New wording, same email: stopped after two.
Traces
OpenTelemetry spans: ok, error, duplicate, refused.

One ticket per car
A4 toll ticket. Nxr-at, CC BY-SA 4.0

Shut until approved
Leidse tolhek. Jane023, CC BY-SA 3.0
{"v":1,"tool":"mail__send_email",
"outcome":"duplicate", …}Record and replay
Every call goes to JSONL. Replay runs it again through the same policies and fails if a tool now answers differently; export it as a promptfoo eval suite.
Guard your tools
Name a tool, pick what the gateway should do, and copy the policy into gateway.yaml.
Add a policy
policies:
mail__send_email: { sideEffect: true, maxAttemptsPerSession: 2 }