Skip to main content
Glama

x402_fetch

Fetch a URL and pay HTTP 402 (x402) requests from a configured wallet only when domain, recipient, asset, and spending limits pass; returns paid, not-required, refused, or failed JSON.

Instructions

Fetch a URL and, if it answers HTTP 402 (x402), pay from the configured wallet only when every rule passes before signing: allowed domain (X402_ALLOWED_DOMAINS), trusted recipient (X402_TRUSTED_PAY_TO), allowed asset (USDC by default; PREQ only if listed; A402 (v1) is deprecated), per-payment and daily limits, and human confirmation above the configured amount. Signs at most once per call. Pass quoteId from x402_quote to refuse if the requirements changed. The wallet key never leaves this machine. Returns JSON with result: "paid" (with the response, amount and settlement transaction) or "not_required" (the URL did not ask for payment; its response is returned); "refused" (with reasons) means nothing was signed; "failed" means a payment was signed but the paid request did not complete (see payment_history). Use x402_quote first to see the price without paying.

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_fetch"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesFull https URL of the paid API endpoint. Its host must be in X402_ALLOWED_DOMAINS.
bodyNoRequest body for POST, as text (at most 100,000 characters).
methodNoHTTP method (default GET).
headersNoExtra request headers, for example content-type. Payment headers are added by the tool.
quoteIdNoquoteId returned by x402_quote. If set, the payment is refused unless amount, asset and recipient still match that quote.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.1.1
    • addedInput schema / properties / body / description
      Added value: +"Request body for POST, as text (at most 100,000 characters)."
    • addedInput schema / properties / headers / description
      Added value: +"Extra request headers, for example content-type. Payment headers are added by the tool."
    • addedInput schema / properties / method / description
      Added value: +"HTTP method (default GET)."
    • addedInput schema / properties / quoteId / description
      Added value: +"quoteId returned by x402_quote. If set, the payment is refused unless amount, asset and recipient still match that quote."
    • addedInput schema / properties / url / description
      Added value: +"Full https URL of the paid API endpoint. Its host must be in X402_ALLOWED_DOMAINS."
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does so well: it discloses that at most one signature happens per call, that the private key never leaves the machine, and that a "refused" result means nothing was signed while "failed" means a signature occurred but the paid request did not complete, pointing to payment_history. Remaining gaps are idempotency/retry behavior and what happens on a second call after a failure.

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 core action and the gate conditions, then the return states. It is a single dense paragraph with multiple parentheticals (asset codes, result meanings), which is slightly run-on for an agent scanning quickly, but every sentence carries information.

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?

No output schema exists, so the description must explain return values, and it enumerates all four result states (paid, not_required, refused, failed) with what each implies. For a five-parameter payment tool with no annotations, nothing an agent needs before calling or interpreting results is missing.

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 baseline is 3; the schema already explains url host requirements, body limits, headers, and quoteId matching. The description reinforces quoteId's workflow role (passing it from x402_quote) but adds little syntax or meaning beyond what the schema states.

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?

Specific verb and resource: fetches a URL and, on HTTP 402, pays from the configured wallet. It explicitly distinguishes itself from x402_quote ("use x402_quote first to see the price without paying"), so an agent can route between the two without opening either 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 explicit when/when-not: use x402_quote first for a price preview, pass its quoteId to guarantee the price did not change, and the payment path only triggers on a 402 response. The rule list (domain allowlist, trusted payee, asset, limits, human confirmation) also tells the agent what preconditions must hold before calling.

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