Skip to main content
Glama
getAlby

Alby Bitcoin Payments MCP Server

Official

get_balance

Retrieve the current balance from your connected Lightning wallet using the MCP server, enabling quick access to your payment details and funds.

Instructions

Get the balance of the connected lightning wallet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the get_balance tool. Fetches the wallet balance using the NWC client, converts from millisats to sats, and returns structured content with the balance.
    async () => { const balance = await client.getBalance(); // Convert millisats to sats const convertedBalance = { amount_in_sats: Math.floor(balance.balance / 1000), // Round down when converting millisats to sats as balance }; return { structuredContent: convertedBalance, content: [ { type: "text", text: JSON.stringify(convertedBalance, null, 2), }, ], }; }
  • Tool schema definition including name, title, description, and output schema using Zod for the balance amount in sats.
    "get_balance", { title: "Get Balance", description: "Get the balance of the connected lightning wallet", outputSchema: { amount_in_sats: z.number().describe("Current wallet balance in sats"), }, },
  • Registers the get_balance tool on the MCP server, including schema and handler.
    export function registerGetBalanceTool( server: McpServer, client: nwc.NWCClient ) { server.registerTool( "get_balance", { title: "Get Balance", description: "Get the balance of the connected lightning wallet", outputSchema: { amount_in_sats: z.number().describe("Current wallet balance in sats"), }, }, async () => { const balance = await client.getBalance(); // Convert millisats to sats const convertedBalance = { amount_in_sats: Math.floor(balance.balance / 1000), // Round down when converting millisats to sats as balance }; return { structuredContent: convertedBalance, content: [ { type: "text", text: JSON.stringify(convertedBalance, null, 2), }, ], }; } ); }
  • Invokes the registration of the get_balance tool during MCP server creation.
    registerGetBalanceTool(server, client);

Other Tools

Related 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/getAlby/mcp'

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