Skip to main content
Glama

x402 preflight: is it safe to pay this endpoint?

x402_preflight
Read-only

Answers "Is it safe to pay this x402 endpoint?" before an agent pays a seller it has not used before. Requests the URL without paying (GET, then POST), reads the 402 challenge (x402 v1 or v2) and checks every payment option: scheme, network, amount, asset, payTo and timeout, testnet vs mainnet, and the price in USD for USDC; whether it declares a valid Bazaar listing; how fast it answers. Screens the payTo wallet against OFAC and, on Base or Ethereum, checks what it is (a wallet, multisig, or a token contract that would swallow the payment). Adds how much the endpoint and its seller are actually used: 30-day calls and unique paying wallets from the Coinbase Bazaar's published figures. Set max_price_usd to enforce a budget. Returns ok_to_pay, caution or do_not_pay with reasons. An unreachable endpoint is an answer (do_not_pay). You are only charged when a result is returned: invalid input (400) and upstream failures (4xx/5xx) are not settled. Costs $0.003 USDC per call via x402. Paid per call with x402 inside MCP (see the server instructions).

Input Schema

NameRequiredDescriptionDefault
urlYesThe paid endpoint, e.g. https://api.example.com/v1/tool.
viaNoOptional: the tool whose next_calls suggested this call (filled in for you).
methodNoHow to request it: auto (default) tries GET, then POST with an empty JSON body.auto
max_price_usdNoYour budget per call: a higher price makes the verdict do_not_pay.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / via
      Added value: +{
      +  "description": "Optional: the tool whose next_calls suggested this call (filled in for you).",
      +  "maxLength": 64,
      +  "type": "string"
      +}
  2. Added

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only supply readOnly/openWorld/idempotent hints, but the description goes far beyond them: it discloses the request mechanics (GET then POST, unpaid), the checks performed (402 challenge parsing, OFAC screen, contract-vs-wallet detection on Base/Ethereum, Bazaar usage figures), the verdict vocabulary, and notably the billing semantics (only charged when a result returns; 400 and 4xx/5xx are not settled, $0.003 USDC per call). That is exactly the extra context an agent needs before invoking a paid tool.

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 decision question and trigger, then moves through checks, verdicts, billing, and cost in a tight sequence. It is long, but nearly every sentence carries distinct operational information; only the title restatement at the top is mildly redundant.

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?

For a no-output-schema tool with an open-world, paid side effect, the description supplies everything needed: the request method, the checks, the return verdicts (ok_to_pay/caution/do_not_pay with reasons), the unreachable-endpoint case, and the settlement rules. Nothing material is left for the agent to infer.

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 all four parameters are already documented, including max_price_usd's effect on the verdict and method's auto GET-then-POST behavior. The description largely restates these ('Set max_price_usd to enforce a budget'; GET, then POST) without adding format or edge-case detail, so the baseline 3 applies.

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 opens with a specific verb and resource framed as a decision question: it answers whether an x402 endpoint is safe to pay before an agent pays an unknown seller. This is a distinct capability no sibling (token_risk_check, wallet_risk_check, counterparty_check, sanctions_screen) covers, so an agent can route to it confidently.

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?

Gives a clear triggering context: run it 'before an agent pays a seller it has not used before', and instructs the agent to use max_price_usd to enforce a budget. It does not name an alternative or state when to skip it (e.g., already-verified sellers), so it stops short of explicit when-not guidance.

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.

Resources