Skip to main content
Glama

Check an x402 endpoint before paying it ($0.001 via x402)

x402_preflight
Read-only

Paid ($0.001 via x402 in USDC on Base, Solana, Monad, Polygon, Arbitrum, Avalanche, Algorand or Stellar, or in RLUSD on the XRP Ledger): call this before your agent pays an x402 endpoint. Returns go, caution or no_go, the recommended payment option, and why: payment would fail, the seller's payout address is on the OFAC SDN sanctions list, over your budget (max_usd), price above what is advertised, not HTTPS, unknown token, its 30-day track record. Never pays the endpoint. The buyer's check for one call; for several endpoints at once use x402_preflight_batch, before a payment above about $1 x402_preflight_deep, and to debug your own endpoint x402_diagnose. Same as GET /api/v1/preflight. The answer carries a signed receipt (EIP-191, bound to your arguments) that proves later which verdict you got.

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": {
      "url": "<url>"
    },
    "name": "x402_preflight"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesThe x402 endpoint (public http(s) URL), e.g. https://api.example.com/paid
bodyNoExample JSON request body, for a POST route that checks its input before the 402 (implies POST). Without it, {} is sent and the requestBody example in the endpoint's /openapi.json is tried.
clientNoSet to gateway when your agent pays with Circle's Gateway client (@circle-fin/x402-batching) from a Gateway balance: Gateway-only endpoints are then not a caution, and Gateway options are recommended first.
methodNoHTTP method of the paid route (default: GET, then POST)
max_usdNoYour budget per call in USD, e.g. 0.05
networkNoCAIP-2 network you want to pay on, e.g. eip155:8453

Output Schema

NameRequiredDescriptionDefault
urlNo
acceptsNoOnly on an unpaid call: the x402 payment options
optionsNoEach payment option with its network, price and problems
reasonsNo
receiptNoSigned receipt (EIP-191) binding the answer to your arguments
summaryNoOne line, e.g. OK to pay: $0.02 on Base.
verdictNo
safe_to_payNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedOutput schema / additionalProperties
      Previous value: -trueNew value: +{}
    • changedOutput schema / properties / accepts / anyOf
      Previous value: -[
      -  {
      -    "$ref": "#/properties/options/anyOf/0"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": {},
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedOutput schema / properties / options / anyOf
      Previous value: -[
      -  {
      -    "items": {
      -      "additionalProperties": {},
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": {},
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedOutput schema / properties / reasons / anyOf
      Previous value: -[
      -  {
      -    "$ref": "#/properties/options/anyOf/0"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": {},
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedOutput schema / properties / receipt / anyOf
      Previous value: -[
      -  {
      -    "additionalProperties": {},
      -    "type": "object"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": {},
      +    "propertyNames": {
      +      "type": "string"
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedOutput schema / properties / verdict / anyOf
      Added value: +[
      +  {
      +    "description": "go: pay; caution: ask first; no_go: do not pay",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • removedOutput schema / properties / verdict / description
      Removed value: -"go: pay; caution: ask first; no_go: do not pay"
    • removedOutput schema / properties / verdict / type
      Removed value: -[
      -  "string",
      -  "null"
      -]
  2. Changed1 schema field changed
    • addedInput schema / properties / body
      Added value: +{
      +  "description": "Example JSON request body, for a POST route that checks its input before the 402 (implies POST). Without it, {} is sent and the requestBody example in the endpoint's /openapi.json is tried.",
      +  "maxLength": 16384,
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedInput schema / properties / client
      Added value: +{
      +  "description": "Set to gateway when your agent pays with Circle's Gateway client (@circle-fin/x402-batching) from a Gateway balance: Gateway-only endpoints are then not a caution, and Gateway options are recommended first.",
      +  "enum": [
      +    "gateway"
      +  ],
      +  "type": "string"
      +}
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": true,
      +  "properties": {
      +    "accepts": {
      +      "anyOf": [
      +        {
      +          "$ref": "#/properties/options/anyOf/0"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Only on an unpaid call: the x402 payment options"
      +    },
      +    "options": {
      +      "anyOf": [
      +        {
      +          "items": {
      +            "additionalProperties": {},
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Each payment option with its network, price and problems"
      +    },
      +    "reasons": {
      +      "anyOf": [
      +        {
      +          "$ref": "#/properties/options/anyOf/0"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ]
      +    },
      +    "receipt": {
      +      "anyOf": [
      +        {
      +          "additionalProperties": {},
      +          "type": "object"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Signed receipt (EIP-191) binding the answer to your arguments"
      +    },
      +    "safe_to_pay": {
      +      "type": [
      +        "boolean",
      +        "null"
      +      ]
      +    },
      +    "summary": {
      +      "description": "One line, e.g. OK to pay: $0.02 on Base.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "url": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "verdict": {
      +      "description": "go: pay; caution: ask first; no_go: do not pay",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    }
      +  },
      +  "type": "object"
      +}
  5. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations cover the read-only/open-world profile, and the description adds what the annotations cannot: the tool never pays, it checks OFAC SDN listing, HTTPS, token support, advertised vs actual price, budget against max_usd, and a 30-day track record. It also discloses that the response carries an EIP-191 signed receipt bound to the arguments, which is non-obvious behavior.

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?

Purpose, price and the core directive are front-loaded before the verdict list and the sibling routing. The prose is dense and the long enumeration of chains and check reasons borders on crowding, but nearly every clause carries usable signal.

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 return values need not be spelled out, yet the description still names the verdict set and the receipt. For a six-parameter preflight tool with sibling alternatives, nothing an agent needs to call it correctly 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 coverage is 100%, so the baseline is 3; the description still adds decision-level meaning by tying max_usd to the 'over your budget' verdict and explaining that the buyer's check is scoped to one call. Other parameters (method, network, body, client) are left to the schema, so it does not fully compensate beyond baseline.

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?

States a concrete verb and resource ('call this before your agent pays an x402 endpoint') plus the exact output shape ('go, caution or no_go'). It explicitly separates itself from siblings x402_preflight_batch, x402_preflight_deep and x402_diagnose, so an agent can select it without opening a schema.

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

Usage Guidelines5/5

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

Gives a clear trigger ('before your agent pays an x402 endpoint') and routes to alternatives with conditions: batch for several endpoints, deep above ~$1, diagnose for your own endpoint. When-to-use and when-to-use-something-else are both explicit.

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.