Skip to main content
Glama

x402_verify_settlement_webhook

Read-onlyIdempotent

Verifies x402/facilitator settlement webhooks with HMAC-SHA256 or Ed25519 signatures, enforcing timestamp skew and idempotency-key deduplication to reject replayed or duplicate payment settlements.

Instructions

Verify x402 / facilitator settlement webhooks via constant-time hmac.compare_digest (HMAC-SHA256) or pure-Python RFC 8032 Ed25519, enforcing timestamp skew limits, mandatory idempotency_key deduplication (SPEC_CLASS_14), integer settlement math (SPEC_CLASS_09), and automatic redaction of accidental API keys, secrets, and payment card digits.

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": {
      "raw_body": "<raw_body>",
      "signature_header": "<signature_header>"
    },
    "name": "x402_verify_settlement_webhook"
  }
}

Input Schema

NameRequiredDescriptionDefault
schemeNoWebhook cryptographic verification scheme.hmac-sha256
raw_bodyYesExact unmutated raw HTTP request JSON body string.
ledger_db_pathNoOptional SQLite WAL database path for persistent `idempotency_key` deduplication.
webhook_secretNoShared HMAC secret when `scheme='hmac-sha256'`.
max_skew_secondsNoAllowed clock skew / replay window in seconds (default `300`).
signature_headerYesSignature header value (hex or base64/base64url, with optional `sha256=`/`v1=`/`ed25519=` prefix).
timestamp_headerNoOptional Unix timestamp header (`<timestamp>.<raw_body>` signing bind + replay window check).
reference_unix_tsNoOptional deterministic Unix timestamp override.
seen_idempotency_keysNoOptional stateless list of already processed `idempotency_key` values.
ed25519_public_key_strNo32-byte Ed25519 public key (hex or base64/base64url) when `scheme='ed25519'`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive), yet the description adds real behavior: constant-time comparison, enforced timestamp skew window, mandatory idempotency deduplication, and automatic redaction of API keys/secrets/card digits in what is returned. One mild tension: ledger_db_path implies persistent dedup bookkeeping on disk, which sits a little awkwardly with readOnlyHint=true, though it is optional and non-destructive.

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?

Single front-loaded sentence with zero filler; every clause carries information (crypto scheme, skew, dedup, spec classes, DLP). It is however a dense run-on with heavy backticked identifiers and parenthetical SPEC_CLASS tags, which slows parsing slightly.

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

Completeness3/5

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

For a 10-parameter tool with no output schema, the description omits the return contract entirely (success/failure shape, rejection reasons) and does not say where the idempotency key comes from despite calling it mandatory. The DLP redaction behavior is the only output-side hint, so the definition is adequate but leaves material gaps.

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

Parameters3/5

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

Schema coverage is 100%, so the schema carries parameter meaning and baseline 3 applies. The description adds conceptual framing (skew = replay window, dedup via ledger) but does not clarify conditional pairing of webhook_secret vs ed25519_public_key_str with the scheme enum, nor how the 'mandatory idempotency_key' is obtained at all – no such parameter exists in the schema.

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

Purpose5/5

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

Specific verb+resource: 'Verify x402 / facilitator settlement webhooks' with the two concrete schemes (HMAC-SHA256, Ed25519) named. This is clearly distinguishable from siblings such as x402_inspect_payment_header (inspection) or x402_enforce_spend_policy (policy enforcement) without opening any schema.

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

Usage Guidelines3/5

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

Usage is only implied by the resource noun ('settlement webhooks') – there is no explicit when-to-use, when-not-to-use, or pointer to an alternative sibling for related tasks. The agent must infer that this is the post-receipt signature verification step rather than, say, header inspection.

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