Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_get_balance

Retrieve account balances on the Zetrix blockchain, displaying amounts in both ZETRIX main units and ZETA micro units for accurate financial tracking.

Instructions

Get the ZETRIX balance of an account. Returns balance in both ZETA (micro units) and ZETRIX (main units). Note: 1 ZETRIX = 1,000,000 ZETA

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesThe Zetrix account address

Implementation Reference

  • Core handler function that executes the tool logic: fetches account info via API, computes balance in both ZETA (micro) and ZETRIX (main) units.
    async getBalance(address: string): Promise<ZetrixBalance> {
      try {
        const account = await this.getAccount(address);
        const balanceInZETA = BigInt(account.balance);
        const balanceInZETRIX = Number(balanceInZETA) / ZETRIX_CONSTANTS.ZETA_PER_ZETRIX;
    
        return {
          address,
          balance: account.balance, // Balance in ZETA (micro units)
          balanceInZETRIX: balanceInZETRIX.toFixed(6), // Balance in ZETRIX (main units)
          balanceInZTX: balanceInZETRIX.toFixed(6), // Deprecated: kept for backwards compatibility
        };
      } catch (error) {
        throw new Error(`Failed to get balance: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • MCP server handler that receives tool call, validates args, invokes ZetrixClient.getBalance, and formats response.
    case "zetrix_get_balance": {
      if (!args) {
        throw new Error("Missing arguments");
      }
      const result = await zetrixClient.getBalance(args.address as string);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Tool schema definition including name, description, and input validation schema requiring 'address' string.
      name: "zetrix_get_balance",
      description: "Get the ZETRIX balance of an account. Returns balance in both ZETA (micro units) and ZETRIX (main units). Note: 1 ZETRIX = 1,000,000 ZETA",
      inputSchema: {
        type: "object",
        properties: {
          address: {
            type: "string",
            description: "The Zetrix account address",
          },
        },
        required: ["address"],
      },
    },
  • Helper method called by getBalance to fetch raw account data from Zetrix RPC API (/getAccount endpoint).
    async getAccount(address: string): Promise<ZetrixAccount> {
      try {
        const response = await this.client.get("/getAccount", {
          params: { address },
        });
    
        if (response.data.error_code !== 0) {
          throw new Error(
            response.data.error_desc || `API Error: ${response.data.error_code}`
          );
        }
    
        const account = response.data.result;
        return {
          address: account.address || address,
          balance: account.balance || "0",
          nonce: account.nonce || 0,
          metadata: account.metadatas,
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Failed to get account: ${error.message}`);
        }
        throw error;
      }
    }
  • Type definition for the balance response structure returned by the tool.
    export interface ZetrixBalance {
      address: string;
      balance: string; // Balance in ZETA (micro units)
      balanceInZETRIX: string; // Balance in ZETRIX (main units)
      balanceInZTX: string; // Deprecated: use balanceInZETRIX
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return format (balance in ZETA and ZETRIX units) and the conversion rate, but fails to address critical aspects like error handling (e.g., invalid addresses), rate limits, authentication needs, or whether this is a read-only operation. This leaves significant gaps for an agent to understand how to invoke it safely.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, followed by essential return details and a unit conversion note. Every sentence adds value without redundancy, making it efficient and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (single parameter, no output schema, no annotations), the description covers the basic purpose and return format adequately. However, it lacks details on behavioral aspects like error conditions or operational constraints, which are important for a tool interacting with a blockchain system. This results in a minimally viable but incomplete context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'address' parameter clearly documented. The description does not add any additional meaning beyond what the schema provides, such as address format examples or validation rules. According to the rules, with high schema coverage, the baseline score is 3, as the schema adequately handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get the ZETRIX balance') and resource ('of an account'), distinguishing it from sibling tools like zetrix_get_account or zetrix_get_account_assets by focusing exclusively on balance retrieval. It also specifies the return format, which further clarifies its purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like zetrix_sdk_get_balance or other account-related tools. The description lacks context about prerequisites, such as whether the account must be activated or have a specific format, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Zetrix-Chain/zetrix-mcp-server'

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