get_transaction
Retrieve detailed blockchain transaction information using transaction hash to inspect transfers, fees, and status across multiple networks.
Instructions
Get transaction details by transaction hash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| network | No | Network type (defaults to mainnet) | |
| txHash | Yes | Transaction hash |
Implementation Reference
- Handler logic for executing the 'get_transaction' tool. Extracts parameters from args, calls advancedBlockchain.getTransaction, and returns formatted JSON response or error.case 'get_transaction': { const blockchain = args?.blockchain as string; const txHash = args?.txHash as string; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await advancedBlockchain.getTransaction(blockchain, txHash, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Input schema defining parameters for get_transaction: blockchain (string), txHash (string, required), network (mainnet|testnet).inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, txHash: { type: 'string', description: 'Transaction hash', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'txHash'], },
- src/index.ts:91-91 (registration)Calls registerTransactionHandlers to register the get_transaction tool (and others) with the MCP server by adding to the tools list used in ListToolsRequestHandler....registerTransactionHandlers(server, advancedBlockchain),
- Core helper function getTransaction that selects the appropriate RPC method based on blockchain type (eth_getTransactionByHash for EVM/L2, getTransaction for Solana) and calls the RPC service.async getTransaction( blockchain: string, txHash: string, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { const service = this.blockchainService.getServiceByBlockchain(blockchain, network); if (!service) { return { success: false, error: `Blockchain service not found: ${blockchain} (${network})`, }; } // Use appropriate method based on blockchain const method = service.category === 'evm' || service.category === 'layer2' ? 'eth_getTransactionByHash' : service.blockchain === 'solana' ? 'getTransaction' : 'eth_getTransactionByHash'; return this.blockchainService.callRPCMethod(service.id, method, [txHash]); }