Skip to main content
Glama

Call a paid API

pay

Calls x402 API endpoints and automatically pays 402 Payment Required challenges by swapping the agent's token to USDG on Uniswap in one transaction, while enforcing per-call, fee, and daily limits.

Instructions

Calls an x402 API. If it answers 402 Payment Required with a Tender option, pays with the agent's token (swapped to USDG on Uniswap in the same transaction) and returns the API's response. Free endpoints are just fetched. Refuses anything above the configured per-call, fee or daily limits.

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": "pay"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesFull URL of the API endpoint
bodyNoRequest body (sent as-is; set content-type in headers if needed)
methodNoHTTP method, default GET
headersNoExtra request headers
max_usdNoRefuse if the API's price is above this many dollars (lower than the configured limit)
pay_withNoToken to pay with for this call (0x…). Omit for the default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false and openWorldHint=true; the description usefully adds that real funds are spent, that a token swap to USDG happens in the same transaction, and that spend limits are enforced. It still omits core financial risk details: whether a failed or reverted call still costs, whether retries double-charge, and what happens when payment is refused mid-flow.

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?

Four sentences, front-loaded with the primary action before the conditional payment path and the refusal rule. Dense and mostly earned, though terms like "Tender option" and "USDG" are introduced without definition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a six-parameter tool with a nested headers object and no output schema, the description does cover the return shape ("returns the API's response") and the payment path. It leaves notable gaps around failure modes, authentication for pay_with, and the fact that the spend is irreversible, which matter for a money-moving tool.

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 six parameters are already documented, including max_usd's relationship to the configured limit. The description adds only peripheral meaning (the limits that max_usd interacts with, the default pay_with token) rather than syntax or format guidance, which is the correct baseline 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 ("Calls an x402 API") and immediately explains the distinctive behavior: paying a 402 challenge and returning the API response. It is clearly not a wallet or pricing tool, though it never names its siblings (quote, check_coin) as the alternatives they are.

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?

It establishes when the tool applies (x402 endpoints, free ones simply fetched) and when it will be blocked (above per-call, fee, or daily limits). It does not, however, point the agent to quote for pre-flight pricing or explain what to do when a 402 has no Tender option.

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

Deploy Server

Other Tools