x402 preflight: ALLOW / WARN / DENY before an agent pays an x402 endpoint
x402_preflightUse 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
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | https URL of the x402 resource you are about to pay | |
| method | No | HTTP method of the resource | |
| max_price_usd | No | Your budget per call in USD; a higher quote gives DENY |