Skip to main content
Glama
presidio-hardened-x402-mcp

presidio-hardened-x402-mcp

by presidio-v

check_payment_replay

Detect and block duplicate x402 payments by checking if the exact payment was recently seen before submission. Records fingerprint once to prevent replays.

Instructions

Check whether this exact payment has been seen recently (replay protection).

WARNING: this records the fingerprint. Call exactly once, immediately before submitting the payment.

Cross-process detection requires PRESIDIO_X402_FINGERPRINT_KEY (and optionally PRESIDIO_X402_MCP_REDIS_URL); otherwise each MCP server process has its own ephemeral in-memory store.

Args: resource_url: x402 resource URL. pay_to: Recipient address. amount: Amount as string (preserves precision). currency: Currency symbol (e.g. "USDC"). deadline_seconds: Payment deadline as epoch seconds. prior_decision_refs: Optional decision_ref values this server returned earlier for the same payment; linked into the signed record. Max 8.

Returns: {"is_replay": false, "fingerprint": ""} on first seen, or {"is_replay": true, "fingerprint": ""} on duplicate; plus decision_ref when signed decision evidence is enabled.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "resource_url": "<resource_url>",
      "pay_to": "<pay_to>",
      "amount": "<amount>",
      "currency": "<currency>",
      "deadline_seconds": "<deadline_seconds>"
    },
    "name": "check_payment_replay"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountYes
pay_toYes
currencyYes
resource_urlYes
deadline_secondsYes
prior_decision_refsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.0
    • addedInput schema / properties / prior_decision_refs
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Prior Decision Refs"
      +}
  2. First observedv0.1.2

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With zero annotations the description carries the full burden and does so: it warns that the call has a recording side effect, explains cross-process behavior depends on PRESIDIO_X402_FINGERPRINT_KEY / PRESIDIO_X402_MCP_REDIS_URL, and states the fallback is a per-process ephemeral store. It also documents both return shapes, which is genuinely beyond structured data.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the purpose, then the timing warning, then Args/Returns—a sensible reading order. The cross-process paragraph is dense but earns its place; overall sizing is appropriate for a tool with a mutation side effect and a config dependency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so the Returns summary is a convenience rather than a requirement, and the args section plus the fingerprint-store caveat cover what an agent needs. Nothing material about invocation risk or environment prerequisites is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the Args block is doing all the work and it does cover all six parameters, adding useful hints like amount being a string to preserve precision and prior_decision_refs capping at 8. Some entries (resource_url, pay_to) are terse restatements rather than semantic clarification, keeping it below a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: checking whether an exact payment has been seen before, framed as replay protection. That is clearly distinct from screening metadata or checking policy, though the description never names the sibling tools to route explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Call exactly once, immediately before submitting the payment" gives an unusually precise usage constraint and sequencing rule. It stops short of naming when to prefer a sibling tool (screen_payment_metadata, check_payment_policy), so alternatives are left implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.