Skip to main content
Glama

check_balance

Check your LightningProx balance in satoshis to pay for Polymarket prediction market analyses on the Bitcoin Lightning network.

Instructions

Check your LightningProx balance in sats. Required to pay for LPXPoly analyses.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler implementation for the "check_balance" tool in the switch-case block of the MCP tool request handler.
    case "check_balance": {
      const balance = await getBalance();
    
      return {
        content: [
          {
            type: "text",
            text: [
              `⚡ LightningProx Balance`,
              `Balance: ${balance.balance_sats} sats`,
              `Estimated analyses remaining: ~${Math.floor(balance.balance_sats / 50)}`,
              ``,
              balance.balance_sats > 0
                ? `✅ Ready for market analysis`
                : `⚠️  No balance. Top up at ${LIGHTNINGPROX_URL}`,
            ].join("\n"),
          },
        ],
      };
    }
  • A helper function that performs the API call to LightningProx to retrieve the user's balance.
    async function getBalance(): Promise<any> {
      const res = await fetch(`${LIGHTNINGPROX_URL}/v1/balance`, {
        headers: { "X-Spend-Token": SPEND_TOKEN },
      });
      if (!res.ok) throw new Error(`Failed to fetch balance: ${res.statusText}`);
      return res.json();
    }
  • src/index.ts:69-77 (registration)
    The tool registration definition for "check_balance" within the tools array.
      name: "check_balance",
      description:
        "Check your LightningProx balance in sats. Required to pay for LPXPoly analyses.",
      inputSchema: {
        type: "object",
        properties: {},
        required: [],
      },
    },

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/lpxpoly-mcp'

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