Skip to main content
Glama

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; } }

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