Skip to main content
Glama

zetrix_sdk_call_contract

Query smart contract functions on the Zetrix blockchain to retrieve data without modifying state. Specify contract address and input parameters to execute read-only calls.

Instructions

Call a smart contract function (query only, no state change) using SDK

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressYesThe deployed smart contract address
inputNoJSON string with method and params
sourceAddressNoOptional source address for the call

Implementation Reference

  • Core handler implementation in ZetrixSDK class that performs the contract call using the official zetrix-sdk-nodejs library's contract.call method.
    async callContract(params: ZetrixContractCallParams): Promise<any> { await this.initSDK(); try { const callParams: any = { contractAddress: params.contractAddress, optType: params.optType || 2, // 2 = query }; if (params.input) callParams.input = params.input; if (params.sourceAddress) callParams.sourceAddress = params.sourceAddress; const result = await this.sdk.contract.call(callParams); if (result.errorCode !== 0) { throw new Error(result.errorDesc || `SDK Error: ${result.errorCode}`); } return result.result; } catch (error) { throw new Error( `Failed to call contract: ${error instanceof Error ? error.message : String(error)}` ); } }
  • MCP server tool call handler (switch case) that extracts parameters and delegates to ZetrixSDK.callContract
    case "zetrix_sdk_call_contract": { if (!args) { throw new Error("Missing arguments"); } const result = await zetrixSDK.callContract({ contractAddress: args.contractAddress as string, optType: args.optType as number | undefined, input: args.input as string | undefined, sourceAddress: args.sourceAddress as string | undefined, }); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • Tool schema definition including name, description, input schema, and required parameters. This is part of the tools array registered with the MCP server.
    { name: "zetrix_sdk_call_contract", description: "Call a smart contract function (query only, no state change) using SDK", inputSchema: { type: "object", properties: { contractAddress: { type: "string", description: "The deployed smart contract address", }, input: { type: "string", description: "JSON string with method and params", }, sourceAddress: { type: "string", description: "Optional source address for the call", }, }, required: ["contractAddress"], }, },

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