Skip to main content
Glama

get_balance

Check your current account balance across all assets in the simulated crypto exchange to monitor portfolio value and track holdings.

Instructions

Get your current account balance across all assets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for get_balance tool that fetches account balance across all assets via API GET /account/balance and returns the data as JSON text content.
    async () => {
      const data = await apiGet<Array<{ asset: string; available: string; locked: string }>>(
        "/account/balance"
      );
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • src/index.ts:276-293 (registration)
    Registration of the get_balance tool with the MCP server using server.tool(), defining the tool name, description, empty schema, and handler function.
    server.tool(
      "get_balance",
      "Get your current account balance across all assets.",
      {},
      async () => {
        const data = await apiGet<Array<{ asset: string; available: string; locked: string }>>(
          "/account/balance"
        );
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(data, null, 2),
            },
          ],
        };
      }
    );
  • Empty schema object {} indicating get_balance takes no input parameters.
    {},
  • The apiGet helper function that performs authenticated HTTP GET requests to the API, used by get_balance to fetch /account/balance endpoint.
    async function apiGet<T>(path: string): Promise<T> {
      const res = await fetch(`${API_BASE}${path}`, {
        headers: getAuthHeaders(),
      });
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`API GET ${path} failed (${res.status}): ${text}`);
      }
      return res.json() as Promise<T>;
    }

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/mikusnuz/pexbot-mcp'

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