Skip to main content
Glama

get_transaction

Retrieve transaction details from EVM-compatible blockchains using a transaction hash, with network specification for accurate data access.

Instructions

Get transaction details by transaction hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
txHashYesTransaction hash (0x...)
networkNoNetwork name or chain ID. Defaults to Ethereum mainnet.

Implementation Reference

  • Registration of the MCP 'get_transaction' tool, including description, Zod input schema (txHash required, network optional), and the complete handler function that fetches and formats the transaction data.
    'get_transaction', 'Get detailed information about a specific transaction by its hash. Includes sender, recipient, value, data, and more.', { txHash: z .string() .describe("The transaction hash to look up (e.g., '0x1234...')"), network: z .string() .optional() .describe( "Network name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. Defaults to Ethereum mainnet." ) }, async ({ txHash, network = 'ethereum' }) => { try { const tx = await services.getTransaction(txHash as Hash, network); return { content: [ { type: 'text', text: services.helpers.formatJson(tx) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching transaction ${txHash}: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );
  • Core helper function implementing the blockchain query for transaction details using viem's PublicClient. Called by the tool handler.
    export async function getTransaction(hash: Hash, network = 'ethereum') { const client = getPublicClient(network); return await client.getTransaction({ hash }); }
  • Full helper function block with documentation for getTransaction, the underlying service used by the get_transaction tool.
    /** * Get a transaction by hash for a specific network */ export async function getTransaction(hash: Hash, network = 'ethereum') { const client = getPublicClient(network); return await client.getTransaction({ hash }); }

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/chulanpro5/evm-mcp-server'

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