Skip to main content
Glama

Buy prepaid ad credit

buy_ad_credit
Idempotent

Buys prepaid ad credit at a fixed price: amount_usd in USDC, 1 USDC = $1.00 of credit (for example 1, 5, 10, 25, 50, 100). The first call returns isError with the x402 PaymentRequired object; call again with the signed payment. Without an API key the paid result carries api_key: the key of a new account whose balance is the credit, shown once. With an API key the credit is added to that account. Orders placed with the key are then paid from the balance, with no further payment.

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": {
      "amount_usd": "<amount_usd>"
    },
    "name": "buy_ad_credit"
  }
}

Input Schema

NameRequiredDescriptionDefault
api_keyNoThe API key of the account (can_live_...). Optional when this MCP connection sends it as the Authorization: Bearer header.
amount_usdYesWhole dollars ("25") or two decimals ("25.00").
idempotency_keyNoOnly to REPEAT an earlier call of this tool (a lost answer, a payment still confirming): the idempotency_key that call returned. Leave it out for a new call; the server then makes a random one and returns it.
payment_signatureNoThe x402 PaymentPayload for the requirement an earlier call of this tool returned, as base64-encoded JSON (the value of an HTTP PAYMENT-SIGNATURE header). An x402-aware MCP client sends the payload in _meta["x402/payment"] instead and leaves this out.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare the non-read-only, idempotent, open-world profile, and the description adds real behavior: a deliberate first-call error carrying x402 terms, an api_key returned once for new accounts, and credit that later orders draw down. What it omits are failure modes (expired or underpaid signatures), whether credit expires, and any partial-failure behavior; the idempotentHint=true claim is also slightly in tension with "the first call returns isError", since an automatic retry pattern is what the two-call dance is for.

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 most decision-relevant facts (what is bought, the exchange rate, the two-call flow) are front-loaded, and each following sentence adds a distinct fact about account binding and balance drawdown. The parenthetical amount list ("1, 5, 10, 25, 50, 100") is redundant against the schema pattern and the prose is dense, but nothing is filler.

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?

With no output schema, the description carries the return-value burden and does describe the two possible outcomes: a PaymentRequired error object or a paid result containing api_key. For a payment tool with four parameters it is largely sufficient, missing only error/recovery cases such as a rejected payment_signature or what happens if the second call is never completed.

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 coverage is 100%, so all four parameters are already documented, including the idempotency_key and payment_signature mechanics. The description adds only the USDC-to-dollar equivalence and example amounts for amount_usd, which is modest value on top of the pattern already in the schema.

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?

"Buys prepaid ad credit at a fixed price" gives a specific verb and resource, and the pricing rule (1 USDC = $1.00) tells the agent exactly what the transaction does. It also implicitly distinguishes itself from create_account by explaining that keyless purchases mint a new account, though it never names a sibling explicitly.

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 gives clear operational guidance for the payment flow: the first call returns a PaymentRequired object and the second call must carry the signed payment, and it distinguishes the API-key versus keyless branches. It stops short of stating when to prefer this over quote_ad or create_account, which is the main gap.

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.

Resources