Skip to main content
Glama
unixlamadev-spec

lightningprox-mcp

get_balance

Check remaining balance on a LightningProx spend token to monitor prepaid access for AI models. Returns balance in sats.

Instructions

Check the remaining balance on a LightningProx spend token. Returns balance in sats.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spend_tokenYesLightningProx spend token (starts with lnpx_)

Implementation Reference

  • The getBalance function fetches the balance from the API using the provided spend token.
    async function getBalance(spendToken: string): Promise<any> {
      const res = await fetch(`${LIGHTNINGPROX_URL}/v1/balance`, {
        headers: { "X-Spend-Token": spendToken },
      });
      if (!res.ok) {
        const err = await res.json() as any;
        throw new Error(err.error || `Balance check failed: ${res.status}`);
      }
      return res.json();
    }
  • src/index.ts:62-75 (registration)
    Tool registration definition for "get_balance".
      name: "get_balance",
      description:
        "Check the remaining balance on a LightningProx spend token. Returns balance in sats.",
      inputSchema: {
        type: "object",
        properties: {
          spend_token: {
            type: "string",
            description: "LightningProx spend token (starts with lnpx_)",
          },
        },
        required: ["spend_token"],
      },
    },
  • MCP request handler logic for "get_balance".
    case "get_balance": {
      const { spend_token } = args as any;
      const data = await getBalance(spend_token);
    
      const sats = data.balance_sats ?? data.sats ?? data.balance ?? "?";
      const usd = data.balance_usd != null ? ` (~$${Number(data.balance_usd).toFixed(4)})` : "";
    
      return {
        content: [
          {
            type: "text",
            text: `⚡ Balance: ${sats} sats${usd}\n\nToken: ${spend_token.slice(0, 16)}…\nTop up: ${LIGHTNINGPROX_URL}/topup`,
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the return format ('balance in sats'), which is helpful, but lacks critical details: whether this is a read-only operation (implied but not stated), authentication requirements, rate limits, error conditions, or what happens with invalid tokens. For a financial tool, this is insufficient 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 a single, efficient sentence with zero wasted words. It front-loads the core purpose ('Check the remaining balance'), specifies the resource, and states the return value—all essential information in minimal text. Every part earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no output schema, no annotations), the description is minimally complete. It covers what the tool does and the return unit, but lacks behavioral context (e.g., safety, errors) that would be needed for robust agent use. Without annotations or output schema, the description should provide more operational details.

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 schema already fully documents the single parameter 'spend_token' with its type, description, and format hint ('starts with lnpx_'). The description adds no additional parameter semantics beyond what's in the schema, meeting the baseline score of 3 for high schema coverage.

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 the remaining balance') on a specific resource ('LightningProx spend token') with the expected return unit ('balance in sats'). It distinguishes from sibling tools like 'check_payment' (which likely verifies payment status) and 'generate_invoice' (which creates payment requests).

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. While it's clear this tool checks balance on a spend token, there's no mention of prerequisites (e.g., token must be valid), when not to use it, or how it differs from 'check_payment' which might have overlapping functionality. The agent must infer usage from the name alone.

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/unixlamadev-spec/lightningprox-mcp'

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