Skip to main content
Glama

binance_account_balances

Retrieve current account balances from Binance using API credentials to monitor cryptocurrency holdings and track portfolio value.

Instructions

Get account balances (requires API key & secret).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler for the binance_account_balances tool. It validates input with balancesSchema, calls the binance.account API endpoint with common params, and returns the balances.
    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 for the tool input parameters (empty object, no params required). Used in parameters and parsed in run.
    const balancesSchema = z.object({});
  • src/index.ts:25-40 (registration)
    Registration of the tool (imported as tool_account_balances and included in tools array at line 19) by adding it to the FastMCP server instance via a loop over all tools.
    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 parameter to API calls.
    export function withCommonParams<T extends Record<string, unknown>>(params: T) { return { ...params, recvWindow }; }
  • Binance Spot client instance used by the tool handler to make the account API 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