Skip to main content
Glama

get_balance

Retrieve current wallet balance across multiple blockchain networks, with optional currency conversion for financial tracking and management.

Instructions

Get the current balance of the wallet.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoQuery balance for specific network (e.g., "polygon-mainnet" or CAIP-2 "eip155:137"). Use "all" for all networks. Required for EVM wallets; auto-resolved for Solana.
display_currencyNoDisplay currency for balance conversion (e.g. KRW, EUR). Defaults to server setting.
wallet_idNoTarget wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.

Implementation Reference

  • The handler function for the get_balance MCP tool, which calls the API to retrieve wallet balances.
      async (args) => {
        const params = new URLSearchParams();
        if (args.network) params.set('network', args.network);
        if (args.display_currency) params.set('display_currency', args.display_currency);
        if (args.wallet_id) params.set('walletId', args.wallet_id);
        const qs = params.toString();
        const result = await apiClient.get('/v1/wallet/balance' + (qs ? '?' + qs : ''));
        return toToolResult(result);
      },
    );
  • Registration function for the get_balance MCP tool.
    export function registerGetBalance(server: McpServer, apiClient: ApiClient, walletContext?: WalletContext): void {
      server.tool(
        'get_balance',
        withWalletPrefix('Get the current balance of the wallet.', walletContext?.walletName),
        {
          network: z.string().optional().describe('Query balance for specific network (e.g., "polygon-mainnet" or CAIP-2 "eip155:137"). Use "all" for all networks. Required for EVM wallets; auto-resolved for Solana.'),
          display_currency: z.string().optional().describe('Display currency for balance conversion (e.g. KRW, EUR). Defaults to server setting.'),
          wallet_id: z.string().optional().describe('Target wallet ID. Required for multi-wallet sessions; auto-resolved when session has a single wallet.'),
        },
        async (args) => {
          const params = new URLSearchParams();
          if (args.network) params.set('network', args.network);
          if (args.display_currency) params.set('display_currency', args.display_currency);
          if (args.wallet_id) params.set('walletId', args.wallet_id);
          const qs = params.toString();
          const result = await apiClient.get('/v1/wallet/balance' + (qs ? '?' + qs : ''));
          return toToolResult(result);
        },
      );
    }

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/minhoyoo-iotrust/WAIaaS'

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