Skip to main content
Glama

get_transaction

Retrieve detailed transaction data, including sender, recipient, value, and input data, using the transaction hash and specified blockchain network.

Instructions

Get detailed information about a specific transaction by its hash. Includes sender, recipient, value, data, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. Defaults to Ethereum mainnet.
txHashYesThe transaction hash to look up (e.g., '0x1234...')

Implementation Reference

  • The MCP tool handler function that executes the get_transaction tool logic. It calls the services.getTransaction helper and returns formatted JSON response or error.
    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 }; } }
  • Zod input schema defining parameters for the get_transaction tool: txHash (required string) and network (optional string).
    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." ) },
  • MCP server.tool registration for the 'get_transaction' tool, including name, description, input schema, and handler function.
    '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 }; } } );
  • Helper service function getTransaction that uses viem public client to fetch transaction details by hash for a given network.
    export async function getTransaction(hash: Hash, network = 'ethereum') { const client = getPublicClient(network); return await client.getTransaction({ hash }); }
  • Top-level server setup calls registerEVMTools which includes the get_transaction tool registration.
    registerEVMResources(server); registerEVMTools(server); registerEVMPrompts(server);

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