Skip to main content
Glama
Zetrix-Chain

Zetrix MCP Server

Official
by Zetrix-Chain

zetrix_get_transaction

Retrieve detailed transaction information from the Zetrix blockchain using a transaction hash to verify status, confirmations, and data.

Instructions

Get transaction details by transaction hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesThe transaction hash

Implementation Reference

  • src/index.ts:106-118 (registration)
    Tool registration in the MCP tools list, including name, description, and input schema definition.
      name: "zetrix_get_transaction",
      description: "Get transaction details by transaction hash",
      inputSchema: {
        type: "object",
        properties: {
          hash: {
            type: "string",
            description: "The transaction hash",
          },
        },
        required: ["hash"],
      },
    },
  • MCP server request handler for the tool: extracts arguments, calls ZetrixClient.getTransaction, and formats response.
    case "zetrix_get_transaction": {
      if (!args) {
        throw new Error("Missing arguments");
      }
      const result = await zetrixClient.getTransaction(args.hash as string);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • Core implementation of getTransaction: makes HTTP GET to Zetrix node /getTransactionHistory endpoint with hash parameter, processes response, extracts and formats transaction details, handles errors.
    async getTransaction(hash: string): Promise<ZetrixTransaction> {
      try {
        const response = await this.client.get("/getTransactionHistory", {
          params: { hash },
        });
    
        if (response.data.error_code !== 0) {
          throw new Error(
            response.data.error_desc || `API Error: ${response.data.error_code}`
          );
        }
    
        const tx = response.data.result.transactions[0];
        const txData = tx.transaction || tx;
        return {
          hash: tx.hash || hash,
          blockNumber: tx.ledger_seq || 0,
          timestamp: tx.close_time || 0,
          sourceAddress: txData.source_address || "",
          feeLimit: txData.fee_limit || "0",
          gasPrice: txData.gas_price || "0",
          nonce: txData.nonce || 0,
          operations: txData.operations,
          status: tx.error_code === 0 ? "success" : "failed",
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Failed to get transaction: ${error.message}`);
        }
        throw error;
      }
    }
  • TypeScript interface defining the structure of the transaction data returned by getTransaction method.
    export interface ZetrixTransaction {
      hash: string;
      blockNumber: number;
      timestamp: number;
      sourceAddress: string;
      feeLimit: string;
      gasPrice: string;
      nonce: number;
      operations?: any[];
      status: string;
    }

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