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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:210-229 (handler)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"), }, ], }; } - src/index.ts:127-133 (helper)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: [], }, },