get_account_info
Retrieve your Binance account details and current balance information through the MCP server integration.
Instructions
获取账户信息和余额
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/account.ts:18-48 (handler)The handler function executes the tool logic: validates input using GetAccountInfoSchema, fetches account information from Binance API, filters balances with non-zero free or locked amounts, computes total, and returns formatted account details including commissions, permissions, and balances.handler: async (binanceClient: any, args: unknown) => { validateInput(GetAccountInfoSchema, args); try { const accountInfo = await binanceClient.accountInfo(); return { makerCommission: accountInfo.makerCommission, takerCommission: accountInfo.takerCommission, buyerCommission: accountInfo.buyerCommission, sellerCommission: accountInfo.sellerCommission, canTrade: accountInfo.canTrade, canWithdraw: accountInfo.canWithdraw, canDeposit: accountInfo.canDeposit, updateTime: accountInfo.updateTime, accountType: accountInfo.accountType, permissions: accountInfo.permissions, balances: accountInfo.balances .filter((balance: any) => parseFloat(balance.free) > 0 || parseFloat(balance.locked) > 0) .map((balance: any) => ({ asset: balance.asset, free: balance.free, locked: balance.locked, total: (parseFloat(balance.free) + parseFloat(balance.locked)).toString(), })), timestamp: Date.now(), }; } catch (error) { handleBinanceError(error); } },
- src/tools/account.ts:10-49 (registration)The get_account_info tool is registered as the first entry in the exported accountTools array, which is later spread into the server's tool map.{ name: 'get_account_info', description: '获取账户信息和余额', inputSchema: { type: 'object', properties: {}, required: [], }, handler: async (binanceClient: any, args: unknown) => { validateInput(GetAccountInfoSchema, args); try { const accountInfo = await binanceClient.accountInfo(); return { makerCommission: accountInfo.makerCommission, takerCommission: accountInfo.takerCommission, buyerCommission: accountInfo.buyerCommission, sellerCommission: accountInfo.sellerCommission, canTrade: accountInfo.canTrade, canWithdraw: accountInfo.canWithdraw, canDeposit: accountInfo.canDeposit, updateTime: accountInfo.updateTime, accountType: accountInfo.accountType, permissions: accountInfo.permissions, balances: accountInfo.balances .filter((balance: any) => parseFloat(balance.free) > 0 || parseFloat(balance.locked) > 0) .map((balance: any) => ({ asset: balance.asset, free: balance.free, locked: balance.locked, total: (parseFloat(balance.free) + parseFloat(balance.locked)).toString(), })), timestamp: Date.now(), }; } catch (error) { handleBinanceError(error); } }, },
- src/types/mcp.ts:22-22 (schema)Zod schema definition for GetAccountInfo input, which is an empty object since no parameters are required.export const GetAccountInfoSchema = z.object({});
- src/tools/account.ts:13-17 (schema)Inline JSON schema provided in the tool registration for input validation, matching the empty object schema.inputSchema: { type: 'object', properties: {}, required: [], },
- src/server.ts:42-50 (registration)In the server's setupTools method, accountTools (containing get_account_info) is spread into allTools and each tool is registered in a Map by name for handling tool calls.const allTools = [ ...marketDataTools, ...accountTools, ...tradingTools, ]; for (const tool of allTools) { this.tools.set(tool.name, tool); }