Skip to main content
Glama

Top up credits

top_up_credits
Destructive

Buy one credit pack on the card your human enrolled, within the monthly top-up limit they set — no new human approval. This CHARGES the human’s card. Pass forCallCredits: the credits the call you are about to make will spend. A pack is charged only when your spendable credits are below that — the recorded consent charges a pack “each time your credits are not enough for a call you make”, so state what that call needs (from a quote or your plan’s per-call cost); when your credits already cover it, nothing is charged (not_needed). Pass a requestId you choose as an idempotency handle: a NEW value for each top-up you intend, the SAME value only to re-send a call that may not have completed (a retry returns the pack already charged, never a second one). Read status: bought added credits (creditsAdded) — unless replayed is true, which means this requestId had already bought one and nothing new was charged (use a new id next time); pending means YOUR pack was charged and is awaiting confirmation (read the balance shortly); busy means another top-up is already being charged — nothing was charged for THIS request, so check your balance shortly and re-send the SAME requestId only if you still need one; limit_reached means this UTC month’s top-up limit is used up (no charge — do not retry until next month); not_needed means your credits already cover the call (no charge); needs_attention means the card was declined or needs 3-D Secure, a card payment to Nevermined is disputed, a human must finish setting top-ups up, a prior top-up is stuck, or a prior top-up’s outcome is unconfirmed (it may have been charged) — hand the human operatorUrl, never try to confirm it yourself, and do not start a new top-up until they act; disabled means a human must turn top-ups on first (give them operatorUrl); unavailable means nothing was charged — retry with a NEW requestId (reusing this one keeps returning the same settled result). monthlyLimitUsd/boughtThisMonthUsd/packPriceUsd are the human-set limit and this month’s spend. Requires your Nevermined API key on the Authorization header; a commerce OAuth grant must have enabled credit top-ups at consent.

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": {
      "requestId": "<requestId>",
      "forCallCredits": "<forCallCredits>"
    },
    "name": "top_up_credits"
  }
}

Input Schema

NameRequiredDescriptionDefault
requestIdYesAn idempotency handle you choose (8–200 chars, letters/digits/._:-). Use a NEW value for each top-up you intend; reuse the SAME value only to re-send a call that may not have completed.
forCallCreditsYesThe credits the call you are about to make will spend. A pack is charged only when your spendable credits are below this; when they already cover it, nothing is charged (`not_needed`).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Far exceeds what the annotations convey: the description discloses that a real card charge occurs, that consent was pre-recorded by a human, the monthly limit semantics, and the full status taxonomy including side effects like 'pending means YOUR pack was charged'. It also names the auth requirements (Nevermined API key header, OAuth grant enabling top-ups). It stops short of explaining what happens to an in-flight pack if the call is never made, which is the one behavioral gap for a destructive tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The first sentence is correctly front-loaded with the action and the charge warning, but the rest is a single dense run-on paragraph mashing idempotency rules and nine status codes together. Every fact is relevant, yet the status enumeration would be far more scannable as a structured list rather than semicolon-chained prose.

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?

There is no output schema, yet the description documents the return statuses and their fields (creditsAdded, replayed, operatorUrl, monthlyLimitUsd, boughtThisMonthUsd, packPriceUsd), so an agent can interpret the response without one. Given the tool is a destructive financial action, the combination of charge disclosure, auth requirements, and failure-mode handling is complete.

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 would be 3, but the description adds genuine semantics the schema lacks: how forCallCredits interacts with spendable balance and which status each case produces, and the full idempotency contract for requestId including the 'replayed' case. This is meaning beyond field-level documentation.

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?

States a specific verb and resource ('Buy one credit pack on the card your human enrolled') plus scope constraints (monthly top-up limit, no new human approval). The contrast with 'no new human approval' and the explicit 'This CHARGES the human's card' clearly separates it from read-only siblings like get_budget or wallet_balance.

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-to-use rules (pass the credits the upcoming call will spend), when nothing happens (credits already cover it -> not_needed), and when not to retry (limit_reached until next month; needs_attention until a human acts). Retry guidance is spelled out per status, including which requestId to reuse versus which to change.

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