tm_get_balances
Retrieve token balances for authenticated users across multiple blockchain networks, with optional filtering by specific chains like Solana or Base.
Instructions
Get token balances for the authenticated user across all chains.
Args:
chain (string, optional): Filter by "solana" or "base"
Returns: Array of { symbol, chain, balance, name }
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Filter by chain |
Implementation Reference
- src/tools/read.ts:101-125 (handler)The handler function for 'tm_get_balances' which fetches balances from the API and filters them by chain if provided.
async ({ chain }) => { const resp = await api.getBalances(); let balances = resp.balances ?? []; if (chain) { balances = balances.filter( (b) => b.chain?.toLowerCase() === chain ); } const items = balances.map((b) => ({ symbol: b.symbol ?? "", name: b.name ?? "", chain: b.chain ?? "", balance: b.balance ?? "0", })); const output = { count: items.length, balances: items }; return { content: [{ type: "text", text: JSON.stringify(output, null, 2) }], structuredContent: output, }; } ); - src/tools/read.ts:83-100 (schema)The input schema and tool metadata for 'tm_get_balances'.
{ title: "Get account balances", description: `Get token balances for the authenticated user across all chains. Args: - chain (string, optional): Filter by "solana" or "base" Returns: Array of { symbol, chain, balance, name }`, inputSchema: { chain: z.enum(["solana", "base"]).optional().describe("Filter by chain"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, - src/tools/read.ts:81-82 (registration)Registration of the 'tm_get_balances' tool within the server.
server.registerTool( "tm_get_balances",