get_balance
Retrieve the current balance of your connected Bitcoin Lightning wallet to monitor funds using the NWC MCP Server.
Instructions
Get the balance of the connected lightning wallet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get_balance.ts:11-21 (handler)The handler function that executes the 'get_balance' tool logic: fetches the wallet balance using the NWC client and returns it formatted as JSON text content.async () => { const balance = await client.getBalance(); return { content: [ { type: "text", text: JSON.stringify(balance, null, 2), }, ], }; }
- src/tools/get_balance.ts:4-23 (registration)The registerGetBalanceTool function that registers the 'get_balance' tool on the MCP server with its description and inline handler.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), }, ], }; } ); }
- src/mcp_server.ts:23-23 (registration)Site where the 'get_balance' tool is registered by calling registerGetBalanceTool during MCP server setup.registerGetBalanceTool(server, client);