Skip to main content
Glama

get_transaction

Retrieve comprehensive details of a transaction using its hash, including sender, recipient, value, and data. Supports multiple networks with BSC as the default.

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. 'bsc', 'opbnb', 'ethereum', 'base', etc.) or chain ID. Supports others main popular networks. Defaults to BSC mainnet.bsc
txHashYesThe transaction hash to look up (e.g., '0x1234...')

Implementation Reference

  • The handler function that executes the logic for the 'get_transaction' tool. It calls the getTransaction service helper, handles errors, and returns the result using mcpToolRes.
    async ({ txHash, network }) => { try { const tx = await services.getTransaction(txHash as Hash, network) return mcpToolRes.success(tx) } catch (error) { return mcpToolRes.error(error, `fetching transaction ${txHash}`) } }
  • Zod input schema defining parameters for the 'get_transaction' tool: txHash (required string) and network (optional, defaults via defaultNetworkParam).
    { txHash: z .string() .describe("The transaction hash to look up (e.g., '0x1234...')"), network: defaultNetworkParam },
  • Registration of the 'get_transaction' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool( "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: defaultNetworkParam }, async ({ txHash, network }) => { try { const tx = await services.getTransaction(txHash as Hash, network) return mcpToolRes.success(tx) } catch (error) { return mcpToolRes.error(error, `fetching transaction ${txHash}`) } } )
  • Helper function getTransaction that retrieves transaction details using the viem public client for the specified network. Called by the tool handler.
    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/bnb-chain/bnbchain-mcp'

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