Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

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"],
      },
    },
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the critical behavioral trait of being read-only ('query only, no state change'), which is essential for a contract interaction tool. However, it lacks details on permissions, rate limits, error handling, or response format, leaving gaps in behavioral context.

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 a single, efficient sentence that front-loads the core purpose and key constraint ('query only, no state change'). Every word earns its place with zero waste, making it highly concise and well-structured.

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 no annotations and no output schema, the description is incomplete for a tool that interacts with smart contracts. It covers the read-only nature but misses details on authentication, response format, error cases, or how it differs from 'zetrix_call_contract'. For a 3-parameter tool with no structured support, more context is needed.

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?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as format examples or constraints. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('Call a smart contract function') and specifies it's for query-only purposes with no state change. It distinguishes from the sibling 'zetrix_sdk_invoke_contract' by emphasizing read-only behavior, though it doesn't explicitly name that alternative.

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

Usage Guidelines3/5

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

The description implies usage context by stating 'query only, no state change,' which suggests when to use this versus mutation tools. However, it doesn't explicitly name alternatives like 'zetrix_sdk_invoke_contract' or provide clear exclusions, leaving some ambiguity.

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