Skip to main content
Glama

pay_then_call

Wrap any paid HTTP endpoint in the x402 pay-then-call loop and return the downstream response plus an EIP-191 signed receipt proving InsureLink mediated the call. The signed context envelope contains: { request: {url, method, body_sha256}, payment: {asset, amount, network, settlement_id}, response: {status, sha256, content_type, length}, observed_at, mediator: 'insurelink' } and a signature recoverable to InsureLink's deployer key. Two modes: (a) caller_supplies_payment — pass x_payment_header (base64) so the upstream call is settled by your wallet; (b) mode='quote_only' — return only the 402 quote without paying. Pass idempotency_key to safely retry: identical requests return the cached signed receipt without settling a second payment, and conflicting payloads under the same key are rejected. Use this to give an LLM verifiable provenance for any paid agent call (banking, market data, gov endpoints).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesTarget paid endpoint.
bodyNoRaw request body. JSON-encode before passing.
modeNo`quote_only` returns the 402 quote without settling. Default `pay_and_call`.
methodNoHTTP method. Default GET.
headersNoExtra request headers (Content-Type, Authorization, etc.).
purposeNoFree-form audit string included in the signed receipt.
agent_walletNoCalling agent wallet (logged in the signed receipt for downstream attribution).
idempotency_keyNoClient-supplied idempotency key. If provided, repeated calls with the same key return the cached response and never settle a second payment. A subsequent call with the same key but a different request payload is rejected with `idempotency_key_conflict`. Keys are retained for 24h.
max_amount_usdcNoRefuse to settle if the 402 quote exceeds this USDC amount. Default 10.
x_payment_headerNoBase64-encoded X-PAYMENT header (caller pre-builds settlement payload). Required unless mode='quote_only'.

TDQS

A4.1/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 of behavioral disclosure. It reveals the signed receipt's envelope structure, the quote_only mode, idempotency semantics (cached receipt, conflict rejection), and that payment is settled by the caller's wallet. The phrase 'caller_supplies_payment' is slightly ambiguous next to the mode enum, but the overall transparency is strong.

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 description is front-loaded with the main purpose, then structured into signed receipt contents, modes, idempotency, and use cases. It is dense but repeats idempotency details already present in the schema, creating minor redundancy. Length is justified by the tool's complexity.

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?

Given 10 parameters, no output schema, and no annotations, the description compensates well by specifying the signed receipt envelope and key behaviors. It does not explicitly walk through the 402 handshake or mention max_amount_usdc's refusal behavior, but the schema covers those, leaving only a small gap.

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 description adds context for x_payment_header and idempotency_key, but most details are already in the schema. It does not introduce syntax or cross-param constraints beyond what the schema provides.

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 clearly states the tool 'Wraps any paid HTTP endpoint in the x402 pay-then-call loop and return[s] the downstream response plus an EIP-191 signed receipt'. It names the specific resource (x402 loop), the action (pay then call), and the output (response + receipt). It also distinguishes itself from simulation siblings by emphasizing real settlement and verifiable provenance.

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?

The description explicitly says 'Use this to give an LLM verifiable provenance for any paid agent call (banking, market data, gov endpoints)' and details two modes (caller-supplied payment vs quote_only). However, it does not explicitly name sibling alternatives like simulate_paid_action or state when not to use it, so it stops just short of full guidance.

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.

TDQS

A3.5/5.0
Disambiguation3/5

Many tools have similar purposes, such as the three simulation tools (simulate_action, simulate_paid_action, simulate_paid_action_batch) and the two payment wrappers (pay_then_call, insurelink_charge). While descriptions clarify distinctions, an agent may struggle to choose correctly without careful reading.

Naming Consistency5/5

All tool names use lowercase snake_case with a consistent verb_noun or verb_noun_noun pattern (e.g., get_reputation, subscribe_attestation_freshness). No mixing of conventions or styles.

Tool Count2/5

With 28 tools, the surface is larger than typical. While each tool serves a specific function, many could be consolidated (e.g., simulation tools, payment wrappers) to reduce cognitive load. The count exceeds the 25-tool threshold for 'too many'.

Completeness3/5

Core operations for reputation, attestation, SLA lifecycle, and payments are present. However, gaps exist: no tool to list individual SLAs or update an SLA beyond renewal/reset, and no dispute or pricing query tool. The set covers the domain but has notable missing operations.

Resources