Skip to main content
Glama

Pay an x402 endpoint in USDC or $THREE and return its result

pay_and_call
Destructive

Calls a paid x402 endpoint, settles the USDC or $THREE payment automatically, and returns the result after price approval. Refuses if the price exceeds the set USD cap.

Instructions

Call a paid x402 endpoint and settle the payment automatically, then return the result. Use this after inspect_endpoint has shown the price and the user has approved paying it; a settled payment cannot be undone.

Two modes: • Self-custodial (default): signs with SOLANA_SECRET_KEY or secret arg; you hold the key. • Session-governed: pass session_token (a three.ws Payment Session token); the platform wallet signs on your behalf; the session's budget, allowlist, and per-tx cap are enforced by the platform. No private key required. Supports Solana USDC and Base USDC sessions.

Pay in USDC (default) or, when the endpoint advertises it, in $THREE (set token:"three"). Bounded by max_usd and the MAX_PAY_USD cap; refuses before any money moves if the price is over the cap. With REQUIRE_CONFIRM on, the call refuses until re-issued with confirm:true.

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

Input Schema

NameRequiredDescriptionDefault
urlYesThe x402 endpoint to pay and call.
bodyNoJSON body for POST requests.
tokenNoSettlement token. "usdc" (default) or "three" — the $THREE platform token; the endpoint must advertise it. Ignored when session_token is set.usdc
methodNoHTTP method.GET
secretNoPer-call base58 signer override (defaults to SOLANA_SECRET_KEY). Ignored when session_token is set.
confirmNoMust be true to execute when REQUIRE_CONFIRM is on.
max_usdNoHard ceiling for THIS call in USD. Can only lower the MAX_PAY_USD cap, never raise it.
session_tokenNothree.ws Payment Session token (pss_…). When provided, the platform wallet pays — no local key needed. Overrides `secret`.
idempotency_keyNoDeduplication key for this call. Recommended when using session_token to avoid double-charges on retries.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.2.3
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / body / propertyNames
      Added value: +{
      +  "type": "string"
      +}
  2. First observedv0.2.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare destructive=true and openWorld=true, but the description adds material context the annotations cannot: payments are irreversible, the cap check happens before any money moves, session budgets/allowlists/per-tx caps are enforced platform-side, and the confirm gate blocks execution until re-issued. It also recommends idempotency_key with session_token to avoid double-charges on retries, which is exactly the guidance a non-idempotent paid call needs.

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 action and the prerequisite are front-loaded, and the two-mode bullet list is an efficient way to present branching behavior. It is dense but nearly every clause carries a distinct constraint; the mode bullets are the only slightly repetitive part given the schema already notes the override rules.

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

Completeness4/5

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

For a 9-parameter, money-moving, open-world tool with no output schema, the description covers prerequisites, safety caps, auth modes, and failure/refusal conditions well. The one gap is that 'return the result' leaves the response shape undefined — an agent cannot tell whether it receives the endpoint's raw body, a wrapped receipt, or settlement metadata.

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, and the description earns above that by explaining the interaction rules the schema only states piecemeal: token is ignored under a session, session_token overrides secret, and max_usd can only lower — never raise — MAX_PAY_USD. It does not expand on body/method beyond what the schema says, so it falls short of a 5.

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 opening sentence gives a specific verb chain (call, settle payment, return result) on a specific resource (a paid x402 endpoint), which is far more precise than the title alone. It also implicitly distinguishes itself from inspect_endpoint by framing inspection as the prerequisite step.

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?

It explicitly states the precondition ('after inspect_endpoint has shown the price and the user has approved paying it'), the irreversibility warning, and the two operating modes with the condition that selects each (self-custodial default vs. session_token). It also documents the confirm-gate re-issue path, so an agent knows exactly when this tool will refuse.

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