Skip to main content
Glama

binance.account.balances

Retrieve cryptocurrency account balances from Binance using API credentials to monitor portfolio holdings.

Instructions

Get account balances (requires API key & secret).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main tool handler: exports tool_account_balances with name, description, schema reference, and async run() that validates input, calls binance.account via the Binance Spot client, and handles errors.
    export const tool_account_balances: BinanceTool = { name: "binance.account.balances", description: "Get account balances (requires API key & secret).", parameters: balancesSchema, async run(input) { balancesSchema.parse(input); try { const res = await binance.account(withCommonParams({})); return res.data?.balances ?? res.data; } catch (err) { throw toToolError(err); } } };
  • Zod schema defining empty input parameters for the tool.
    const balancesSchema = z.object({});
  • src/index.ts:14-39 (registration)
    The tool is included in the tools array (line 18) and registered via server.addTool() in the forEach loop, copying name, description, parameters, and wrapping execute around the tool's run().
    const tools = [ tool_market_price, tool_market_klines, tool_exchange_info, tool_account_balances, tool_open_orders, tool_place_order, tool_cancel_order, ]; tools.forEach((tool) => { server.addTool({ name: tool.name, description: tool.description, parameters: tool.parameters, execute: async (args) => { try { const result = await tool.run(args); return JSON.stringify(result, null, 2); } catch (error) { const handled = error instanceof ToolError ? error : new ToolError((error as Error).message); throw handled; } }, }); });
  • Helper function used in the handler to add recvWindow to API params.
    export function withCommonParams<T extends Record<string, unknown>>(params: T) { return { ...params, recvWindow }; }
  • Binance Spot client instance used by the handler's binance.account call.
    export const binance = new Spot(apiKey, apiSecret, { baseURL });

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/Valerio357/binance-mcp'

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