Skip to main content
Glama

x402 Envelope Auditor

x402-envelope-auditor
Read-onlyIdempotent

Normalize and audit an x402 402-payment envelope before an agent spends. Accepts a raw response body, a JSON envelope, or x402 payment headers and returns requirement count, networks, schemes, payTo recipients, USDC price bounds, the cheapest compatible Base-USDC requirement, a deterministic allow/review/deny decision, facilitator hints, and fail-closed warnings for malformed or non-Base quotes. $0.01/call.

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": {
      "envelope": "<envelope>"
    },
    "name": "x402-envelope-auditor"
  }
}

Input Schema

NameRequiredDescriptionDefault
headersNoOptional response headers. Header values may include payment-required JSON or base64 encoded JSON.
maxUsdcNoOptional caller budget in USDC. Emits a warning when the cheapest requirement exceeds it.
envelopeYesRaw x402 response body or JSON object containing accepts/paymentRequirements/requirements.
expectedAssetNoExpected USDC asset address on Base.0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
expectedNetworkNoExpected payment network. Defaults to Base mainnet CAIP-2.eip155:8453

Output Schema

NameRequiredDescriptionDefault
okYes
payToYes
schemesYes
decisionYes
evidenceYes
networksYes
warningsYes
cheapestUsdcYes
requirementsYes
withinBudgetYes
baseCompatibleYes
requirementCountYes
mostExpensiveUsdcYes
cheapestCompatibleYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), so the bar is lower, and the description still adds real behavior: a deterministic allow/review/deny outcome and fail-closed warnings on malformed or non-Base quotes. It also discloses a per-call price of $0.01, which is cost information the annotations cannot convey. Minor gap: it does not say how the decision is reached or whether warnings accompany a deny.

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?

Two sentences, front-loaded with the core action and input flexibility, with zero preamble. The second sentence is a long comma-separated output enumeration that borders on a run-on, but every clause names a distinct, useful output.

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

Completeness4/5

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

With five parameters, one required, and an output schema present, the description gives enough to call the tool correctly: accepted input shapes, the decision semantics, and fail-closed behavior. The lengthy return-value listing is somewhat redundant against the output schema, and the meaning of the review verdict versus deny is not spelled out, leaving a small gap.

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 description coverage is 100%, so the schema already documents envelope, headers, maxUsdc, expectedAsset, and expectedNetwork. The description only indirectly gestures at these via 'cheapest compatible Base-USDC requirement' and 'USDC price bounds' rather than explaining how the expected* defaults drive the decision. Baseline 3 is appropriate when the schema carries the parameter burden.

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?

The description states a specific verb pair (normalize and audit) against a specific resource (x402 402-payment envelope), plus the moment of use (before an agent spends). It also enumerates the returned artifacts, so an agent knows exactly what it gets. No sibling covers payment-envelope auditing, so differentiation is implicit but unmistakable.

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?

The phrase 'before an agent spends' gives clear situational context for invoking the tool, and the accepted input forms (raw body, JSON envelope, or headers) tell the agent it can pass whatever it has on hand. No explicit when-not-to-use guidance or named alternative is given, but there is no sibling that could be confused with it.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.