Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_call_contract

Execute smart contract functions in a sandbox environment to test and debug blockchain interactions without deploying to mainnet.

Instructions

Call smart contract in sandbox environment for debugging

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractAddressNoDeployed contract address (optional)
codeNoContract source code (optional)
inputNoFunction parameters (optional)
contractBalanceNoContract balance (optional)
feeLimitNoFee limit (optional)
gasPriceNoGas price (optional)
optTypeNoOperation type (optional)
sourceAddressNoSource address (optional)

Implementation Reference

  • Handler for zetrix_call_contract tool: maps input arguments to parameters and delegates to ZetrixClient.callContract
    case "zetrix_call_contract": {
      const params: any = {};
      if (args?.contractAddress) params.contract_address = args.contractAddress;
      if (args?.code) params.code = args.code;
      if (args?.input) params.input = args.input;
      if (args?.contractBalance) params.contract_balance = args.contractBalance;
      if (args?.feeLimit) params.fee_limit = args.feeLimit;
      if (args?.gasPrice) params.gas_price = args.gasPrice;
      if (args?.optType) params.opt_type = args.optType;
      if (args?.sourceAddress) params.source_address = args.sourceAddress;
    
      const result = await zetrixClient.callContract(params);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the zetrix_call_contract tool, defining all optional parameters
    {
      name: "zetrix_call_contract",
      description: "Call smart contract in sandbox environment for debugging",
      inputSchema: {
        type: "object",
        properties: {
          contractAddress: {
            type: "string",
            description: "Deployed contract address (optional)",
          },
          code: {
            type: "string",
            description: "Contract source code (optional)",
          },
          input: {
            type: "string",
            description: "Function parameters (optional)",
          },
          contractBalance: {
            type: "string",
            description: "Contract balance (optional)",
          },
          feeLimit: {
            type: "string",
            description: "Fee limit (optional)",
          },
          gasPrice: {
            type: "string",
            description: "Gas price (optional)",
          },
          optType: {
            type: "number",
            description: "Operation type (optional)",
          },
          sourceAddress: {
            type: "string",
            description: "Source address (optional)",
          },
        },
      },
    },
  • src/index.ts:768-770 (registration)
    Registers all tools including zetrix_call_contract for the ListToolsRequestHandler
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Core implementation of contract call: sends POST request to Zetrix node's /callContract endpoint in sandbox environment
    async callContract(params: {
      contract_address?: string;
      code?: string;
      input?: string;
      contract_balance?: string;
      fee_limit?: string;
      gas_price?: string;
      opt_type?: number;
      source_address?: string;
    }): Promise<ZetrixContractCallResult> {
      try {
        const response = await this.client.post("/callContract", params);
    
        if (response.data.error_code !== 0) {
          throw new Error(
            response.data.error_desc || `API Error: ${response.data.error_code}`
          );
        }
    
        return response.data.result;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Failed to call contract: ${error.message}`);
        }
        throw error;
      }
    }
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 sandbox environment and debugging purpose, which is helpful, but doesn't describe what 'call' entails (e.g., read-only vs. state-changing, error handling, or output format). For a contract interaction tool with 8 parameters, this leaves significant gaps in understanding its behavior.

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 key information: action ('call smart contract'), environment ('sandbox'), and purpose ('debugging'). There's no wasted verbiage, making it appropriately concise for the tool's complexity.

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

Completeness2/5

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

Given the complexity of smart contract calls, 8 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns, how errors are handled, or the implications of the sandbox environment (e.g., state persistence). For a debugging tool with many optional inputs, more context is needed to use it effectively.

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 all 8 parameters documented as optional. The description adds no additional parameter information beyond what's in the schema (e.g., it doesn't explain relationships between parameters like 'contractAddress' and 'code'). Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't detract either.

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 smart contract') and context ('in sandbox environment for debugging'), which is specific and distinguishes it from production contract calls. However, it doesn't explicitly differentiate from sibling tools like 'zetrix_sdk_call_contract' or 'zetrix_sdk_invoke_contract', which appear to have overlapping functionality.

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 for debugging in a sandbox environment, which provides some context about when to use it (for testing rather than production). However, it doesn't specify when to choose this tool over alternatives like 'zetrix_sdk_call_contract' or 'zetrix_test_transaction', nor does it mention any prerequisites or exclusions.

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