Skip to main content
Glama

check_balance

Check remaining Pollinations API credits for paid models to monitor usage and manage access to image, video, and audio generation tools.

Instructions

Check your Pollinations API balance (pollen). Shows remaining credits for paid models.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that performs the HTTP request to Pollinations API to check the account balance.
    export async function handleCheckBalance() {
      if (!API_KEY) {
        return {
          content: [
            {
              type: "text" as const,
              text: "No POLLINATIONS_API_KEY set. Balance check requires an API key.\nFree models (flux, turbo) work without a key.",
            },
          ],
        };
      }
    
      try {
        const res = await fetch("https://gen.pollinations.ai/account/balance", {
          headers: { Authorization: `Bearer ${API_KEY}` },
        });
    
        if (!res.ok) {
          return {
            content: [{ type: "text" as const, text: `Balance check failed: HTTP ${res.status}` }],
            isError: true,
          };
        }
    
        const data = await res.json() as { balance?: number; pollen?: number };
        const balance = data.balance ?? data.pollen ?? 0;
    
        return {
          content: [
            {
              type: "text" as const,
              text: [
                `Pollinations balance: ${balance} pollen`,
                `API key: ${API_KEY.slice(0, 6)}...${API_KEY.slice(-4)}`,
                "",
                "Free models (flux, turbo, wan2.6) use 0 pollen.",
                "Paid models: gptimage ~5, imagen-4 ~3, grok-imagine ~3, seedance-pro ~20 pollen/gen.",
              ].join("\n"),
            },
          ],
        };
      } catch (err) {
        return {
          content: [{ type: "text" as const, text: `Balance check error: ${err}` }],
          isError: true,
        };
      }
    }
  • The input schema definition for the check_balance tool.
    export const checkBalanceSchema = z.object({});
  • src/index.ts:71-76 (registration)
    The registration of the check_balance tool within the MCP server.
    server.tool(
      "check_balance",
      "Check your Pollinations API balance (pollen). Shows remaining credits for paid models.",
      checkBalanceSchema.shape,
      async () => handleCheckBalance()
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the tool's purpose (checking balance) and output type (remaining credits), but lacks details on behavioral traits like rate limits, authentication needs, error conditions, or whether it's read-only (implied but not stated). It adds basic context but misses operational specifics.

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 a single, efficient sentence that front-loads the core purpose ('Check your Pollinations API balance') and adds clarifying detail ('pollen', 'remaining credits for paid models'). Every word earns its place with zero waste, making it easy to parse quickly.

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 the tool's simplicity (0 parameters, no annotations, no output schema), the description is reasonably complete. It explains what the tool does and what information it provides. However, without an output schema, it could benefit from more detail on the return format (e.g., numeric value, JSON structure), slightly limiting completeness for an AI agent.

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?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description adds no parameter information, which is appropriate here. Baseline is 4 for zero parameters, as no additional semantics are needed 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 specific action ('Check'), resource ('Pollinations API balance'), and what it shows ('remaining credits for paid models'). It distinguishes itself from siblings like list_models or generate_image by focusing on account credits rather than content generation or listing resources.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('paid models') but doesn't explicitly state when to use this tool versus alternatives. It doesn't provide guidance on prerequisites, frequency, or comparisons with other tools, leaving usage decisions to inference rather than explicit direction.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/doctorm333/promptpilot-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server