Skip to main content
Glama

zetrix_sdk_get_balance

Retrieve the current balance for a specified Zetrix blockchain account address using the official SDK.

Instructions

Get account balance using the official SDK

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesThe Zetrix account address

Implementation Reference

  • Core handler implementation: Queries account balance using the official zetrix-sdk-nodejs package via dynamic import and SDK initialization.
    async getBalance(address: string): Promise<ZetrixSDKBalance> { await this.initSDK(); try { const result = await this.sdk.account.getBalance(address); if (result.errorCode !== 0) { throw new Error(result.errorDesc || `SDK Error: ${result.errorCode}`); } return { address, balance: result.result.balance, }; } catch (error) { throw new Error( `Failed to get balance: ${error instanceof Error ? error.message : String(error)}` ); } }
  • src/index.ts:428-441 (registration)
    Tool registration in the MCP tools array, including name, description, and input schema.
    { name: "zetrix_sdk_get_balance", description: "Get account balance using the official SDK", inputSchema: { type: "object", properties: { address: { type: "string", description: "The Zetrix account address", }, }, required: ["address"], }, },
  • MCP server dispatcher: Handles tool call by invoking ZetrixSDK.getBalance and formatting response.
    case "zetrix_sdk_get_balance": { if (!args) { throw new Error("Missing arguments"); } const balance = await zetrixSDK.getBalance(args.address as string); return { content: [ { type: "text", text: JSON.stringify(balance, null, 2), }, ], }; }
  • Helper method to lazily initialize the official Zetrix SDK instance.
    private async initSDK() { if (this.sdk) return; try { // Dynamically import the CommonJS module const module = await import("zetrix-sdk-nodejs"); const ZtxChainSDK = module.default || module; this.sdk = new ZtxChainSDK({ host: this.host }); } catch (error) { throw new Error( `Failed to initialize Zetrix SDK: ${error instanceof Error ? error.message : String(error)}` ); } }

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