Skip to main content
Glama

get_balance

Retrieve the current balance from a connected Bitcoin Lightning wallet to monitor available funds for transactions.

Instructions

Get the balance of the connected lightning wallet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Async handler function that executes the get_balance tool: fetches wallet balance using NWC client and returns it formatted as JSON text.
    async () => {
      const balance = await client.getBalance();
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(balance, null, 2),
          },
        ],
      };
    }
  • Registers the get_balance tool on the MCP server using server.tool(), including the tool name, description, and handler function.
    export function registerGetBalanceTool(
      server: McpServer,
      client: nwc.NWCClient
    ) {
      server.tool(
        "get_balance",
        "Get the balance of the connected lightning wallet",
        async () => {
          const balance = await client.getBalance();
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(balance, null, 2),
              },
            ],
          };
        }
      );
    }
  • Calls registerGetBalanceTool to register the get_balance tool during MCP server creation.
    registerGetBalanceTool(server, client);

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/nwc-mcp-server'

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