Skip to main content
Glama

Own prepaid credit balance

get_credit_balance
Read-onlyIdempotent

Check the authenticated key's prepaid credit balance before metered calls and verify top-ups landed, preventing insufficient-credit failures.

Instructions

Call this BEFORE a batch of metered calls to confirm the calling key's prepaid credit balance covers it, and AFTER a 402 INSUFFICIENT_CREDITS + human top-up to verify the funds landed. The balance is ALWAYS the authenticated key's own — no parameters, so reading another key's balance is structurally impossible. Returns api_key_id (non-secret UUID), balance_ore (whole øre, always an integer), currency (NOK), updated_at (null = never topped up = balance 0), and top_up_url (hand it to a human; agents cannot pay directly). For affordability, multiply cost_ore from get_pricing by the planned call count and compare against balance_ore. Free (unmetered), zero side effects. Failure modes: 401 without a key (NOT keyless — use get_pricing for keyless price discovery); SCOPE_INSUFFICIENT (needs read:credits or read:*); CREDIT_BALANCE_UNAVAILABLE (503, retryable — a money read is never fabricated). Under a sandbox bearer it returns SANDBOX_TOOL_UNAVAILABLE. Docs: https://www.apier.no/docs/guides/agent-payments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
_metaNo
resultYesThe authenticated key's own prepaid balance: api_key_id, balance_ore, currency, updated_at, top_up_url.
metadataYes
justificationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A5/5.0
Behavior5/5

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

Beyond annotations (readOnly, idempotent), the description adds valuable behavioral context: 'Free (unmetered), zero side effects', explicit failure modes (401, SCOPE_INSUFFICIENT, CREDIT_BALANCE_UNAVAILABLE, SANDBOX_TOOL_UNAVAILABLE), and semantic details like updated_at null meaning never topped up. It also clarifies why another key's balance cannot be read, enhancing transparency.

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

Conciseness5/5

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

The description is front-loaded with the most important usage directive ('Call this BEFORE...'), followed by concise output and error details. Every sentence adds unique information, and the structure flows from usage to data to failure modes to alternative tools. No redundancy or filler.

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?

Given zero parameters, a rich output schema, and thorough annotations, the description fully covers the tool's purpose, usage sequence, output semantics, pricing integration, and failure modes. It is complete enough for an agent to infer when and how to invoke this tool, including edge cases like sandbox behavior and 503 retries.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With zero parameters, the baseline is 4, but the description goes further by explaining the absence: 'no parameters, so reading another key's balance is structurally impossible.' It also details the return fields (api_key_id, balance_ore, currency, updated_at, top_up_url) and how to use them with get_pricing, adding semantic value beyond the empty schema.

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 reads the authenticated key's prepaid credit balance, with the exact resource ('own prepaid credit balance') and explicit scoping ('ALWAYS the authenticated key's own'). It distinguishes from sibling get_pricing by noting 'NOT keyless — use get_pricing for keyless price discovery', making the purpose unambiguous.

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?

Provides explicit when-to-use guidance: 'Call this BEFORE a batch of metered calls to confirm the calling key's prepaid credit balance covers it, and AFTER a 402 INSUFFICIENT_CREDITS + human top-up to verify the funds landed.' It also names the alternative for keyless scenarios, satisfying the when-not/alternatives criterion.

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