Skip to main content
Glama

getWalletInfo

Retrieve detailed wallet information for any Binance Smart Chain address, including balances and transaction history, using the BSC MCP Server API.

Instructions

Get wallet info for an address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressNo

Implementation Reference

  • The core handler function for the 'Get_Wallet_Info' tool. Fetches balance for the provided or user's own wallet address using getBalance helper, formats native BNB balance, token balances, and address into text content, or returns error response.
    async ({ address }) => { try { if (address === '' || !address || address === 'null') { const account = await getAccount(); address = account.address } const balance = await getBalance(address); return { content: [ { type: "text", text: `Native Balance (BNB): ${balance.nativeBalance}\n\nToken Balances:\n${JSON.stringify(balance.tokenBalances)}\n\nWallet Address: ${address}`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Failed to fetch balance: ${errorMessage}` }, ], isError: true, }; } }
  • Zod input schema for the tool: optional 'address' string parameter for the wallet address to query.
    address: z.string().optional().describe("When querying the user's own wallet value, it is null"),
  • Registration function for the 'Get_Wallet_Info' tool, called by main.ts. Registers the tool on the McpServer with name, description, input schema, and handler function.
    export function registerGetWalletInfo(server: McpServer) { server.tool("Get_Wallet_Info", "👛View detailed balance and holdings for any wallet address", { address: z.string().optional().describe("When querying the user's own wallet value, it is null"), }, async ({ address }) => { try { if (address === '' || !address || address === 'null') { const account = await getAccount(); address = account.address } const balance = await getBalance(address); return { content: [ { type: "text", text: `Native Balance (BNB): ${balance.nativeBalance}\n\nToken Balances:\n${JSON.stringify(balance.tokenBalances)}\n\nWallet Address: ${address}`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Failed to fetch balance: ${errorMessage}` }, ], isError: true, }; } } ); }
  • src/main.ts:30-30 (registration)
    Call to registerGetWalletInfo during MCP server initialization, integrating the tool into the server.
    registerGetWalletInfo(server);

Other Tools

Related Tools

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/TermiX-official/bsc-mcp'

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