Skip to main content
Glama
5ajaki
by 5ajaki

ethereum_getTransactionInfo

Retrieve detailed Ethereum transaction data, including status, gas usage, and block details, by providing the transaction hash through Veri5ight MCP Server.

Instructions

Get detailed information about an Ethereum transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesTransaction hash

Implementation Reference

  • The handler function that retrieves detailed Ethereum transaction information, including status, from/to addresses with ENS resolution, value, gas details, input data, and event logs using the ethers provider.
    private async handleGetTransactionInfo(request: any) { try { const hash = request.params.arguments?.hash; if (!hash) { throw new Error("Transaction hash is required"); } // Log the network we're connected to const network = await this.provider.getNetwork(); console.error( `Looking up transaction on network: ${network.name} (chainId: ${network.chainId})` ); // Get transaction and receipt in parallel const [tx, receipt] = await Promise.all([ this.provider.getTransaction(hash).catch((error) => { console.error(`Error fetching transaction: ${error.message}`); return null; }), this.provider.getTransactionReceipt(hash).catch((error) => { console.error(`Error fetching receipt: ${error.message}`); return null; }), ]); if (!tx) { throw new Error(`Transaction not found. Please verify: 1. The transaction hash is correct 2. The transaction exists on network ${network.name} 3. Your node is fully synced`); } // Resolve ENS names in parallel const [fromENS, toENS] = await Promise.all([ tx.from ? this.provider.lookupAddress(tx.from).catch(() => null) : null, tx.to ? this.provider.lookupAddress(tx.to).catch(() => null) : null, ]); // Format values const value = tx.value ? ethers.formatEther(tx.value) : "0"; const gasPrice = tx.gasPrice ? ethers.formatUnits(tx.gasPrice, "gwei") : "unknown"; const status = receipt ? receipt.status === 1 ? "Success" : "Failed" : "Pending"; const gasUsed = receipt ? receipt.gasUsed.toString() : "unknown"; // Get any contract interaction data let methodInfo = ""; if (tx.data && tx.data !== "0x") { try { methodInfo = `\n• Input Data: ${tx.data}`; } catch (error) { console.error("Error decoding transaction data:", error); } } // Format event logs with ENS resolution let eventLogs = ""; if (receipt && receipt.logs.length > 0) { eventLogs = "\n\nEvent Logs:"; for (const log of receipt.logs) { try { const contractENS = await this.provider .lookupAddress(log.address) .catch(() => null); eventLogs += `\n• From Contract: ${contractENS || log.address}`; eventLogs += `\n Topics: ${log.topics.join(", ")}`; if (log.data && log.data !== "0x") { eventLogs += `\n Data: ${log.data}`; } } catch (error) { console.error("Error processing log:", error); } } } return { content: [ { type: "text", text: `Transaction Information for ${hash}: • Status: ${status} • From: ${fromENS || tx.from} • To: ${toENS || tx.to || "Contract Creation"} • Value: ${value} ETH • Gas Price: ${gasPrice} Gwei • Gas Used: ${gasUsed} • Block Number: ${tx.blockNumber || "Pending"}${methodInfo}${eventLogs}`, }, ], }; } catch (error: unknown) { console.error("Error getting transaction info:", error); const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `Error getting transaction info: ${errorMessage}`, }, ], }; } }
  • Tool schema definition including name, description, and input schema requiring a transaction hash.
    { name: "ethereum_getTransactionInfo", description: "Get detailed information about an Ethereum transaction", inputSchema: { type: "object", properties: { hash: { type: "string", description: "Transaction hash", }, }, required: ["hash"], }, },
  • src/index.ts:160-161 (registration)
    Switch case registration that routes calls to the ethereum_getTransactionInfo handler.
    case "ethereum_getTransactionInfo": return await this.handleGetTransactionInfo(request);

Other Tools

Related 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/5ajaki/veri5ight'

If you have feedback or need assistance with the MCP directory API, please join our Discord server