Skip to main content
Glama
jun229

truemarkets-mcp-server

by jun229

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
NameRequiredDescriptionDefault
chainNoFilter by chain

Implementation Reference

  • 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,
        };
      }
    );
  • 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,
          },
        },
  • Registration of the 'tm_get_balances' tool within the server.
    server.registerTool(
      "tm_get_balances",

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/jun229/tm-mcp-server'

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