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
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | Network name (e.g. 'bsc', 'opbnb', 'ethereum', 'base', etc.) or chain ID. Supports others main popular networks. Defaults to BSC mainnet. | bsc |
| txHash | Yes | The 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 },
- src/evm/modules/transactions/tools.ts:11-28 (registration)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 }) }