Skip to main content
Glama

x402 preflight: ALLOW / WARN / DENY before an agent pays an x402 endpoint

x402_preflight
Read-onlyIdempotent

Use when an agent is about to pay an unknown x402 endpoint and needs a cheap safety gate. Input: url (https x402 resource), method, optional max_price_usd. Output: JSON verdict ALLOW/WARN/DENY with reasons: live quote now, price vs similar routes and your budget, payTo on the OFAC list, price change vs our last measurement, our 7-day uptime/p95, ERC-8004 registration. Never pays; cached 60 s. Use instead: x402_lint for grading your own endpoint; x402_api_recommend for finding an API. Example: ?url=https://1gateway.dev/v1/fx/rates&max_price_usd=0.01 Price: $0.002 per call, paid in USDC (Base, Monad, Polygon, Arbitrum or Solana) via x402.

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
urlYeshttps URL of the x402 resource you are about to pay
methodNoHTTP method of the resource
max_price_usdNoYour budget per call in USD; a higher quote gives DENY

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / additionalProperties
      Removed value: -false
  2. Changed1 schema field changed
    • addedInput schema / additionalProperties
      Added value: +false
  3. Changed1 schema field changed
    • removedInput schema / additionalProperties
      Removed value: -false
  4. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations (readOnly, idempotent, openWorld), the description discloses that it never pays, that results are cached 60 seconds, and exactly which checks produce a verdict: live quote, price vs similar routes and budget, payTo OFAC screening, price drift vs prior measurement, 7-day uptime/p95, and ERC-8004 registration. This is materially richer than the annotation set.

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?

The critical information (when to use, what the verdict means, never pays, cached 60 s, alternatives) is front-loaded in a compact block with no filler sentences. The trailing pricing/chain note ('$0.002 per call ... USDC (Base, Monad, Polygon, Arbitrum or Solana)') is somewhat dense and partially off-task, but it does inform cost expectations.

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?

There is no output schema, and the description compensates by enumerating the verdict values and every reason category that can appear. Combined with the usage trigger, the alternative routing, and the caching note, an agent has everything needed to call this correctly.

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 would be 3, but the description adds real meaning: url must be an https x402 resource the agent is about to pay, and max_price_usd is tied to the DENY outcome at a higher quote. The worked example with a concrete url and max_price_usd value further pins down usage format.

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 names a concrete verb-like action (a 'cheap safety gate' / preflight), the exact resource (an x402 endpoint the agent is about to pay), and the output shape (ALLOW/WARN/DENY verdict). It explicitly differentiates itself from the two nearest siblings, proving an agent can route to it without opening schemas.

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?

States the trigger condition explicitly: 'Use when an agent is about to pay an unknown x402 endpoint.' It also supplies exclusions and alternatives in 'Use instead: x402_lint for grading your own endpoint; x402_api_recommend for finding an API,' leaving nothing to inference.

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