Skip to main content
Glama

get_transaction_receipt

Retrieve transaction confirmation status, gas usage details, and event logs from EVM-compatible blockchains to verify transaction completion.

Instructions

Get transaction receipt (confirmation status, gas used, logs). Use this to check if a transaction has been confirmed.

Input Schema

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

Implementation Reference

  • MCP tool handler: fetches transaction receipt via service, formats as JSON text content, handles errors with isError flag.
    async ({ txHash, network = 'ethereum' }) => {
      try {
        const receipt = await services.getTransactionReceipt(
          txHash as Hash,
          network
        );
    
        return {
          content: [
            {
              type: 'text',
              text: services.helpers.formatJson(receipt)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error fetching transaction receipt ${txHash}: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema: txHash (string, required), network (string, optional).
    {
      txHash: z.string().describe('The transaction hash to look up'),
      network: z
        .string()
        .optional()
        .describe('Network name or chain ID. Defaults to Ethereum mainnet.')
  • Tool registration via server.tool call in registerEVMTools, including name, description, schema, and handler.
    // Get transaction receipt
    server.tool(
      'get_transaction_receipt',
      'Get a transaction receipt by its hash',
      {
        txHash: z.string().describe('The transaction hash to look up'),
        network: z
          .string()
          .optional()
          .describe('Network name or chain ID. Defaults to Ethereum mainnet.')
      },
      async ({ txHash, network = 'ethereum' }) => {
        try {
          const receipt = await services.getTransactionReceipt(
            txHash as Hash,
            network
          );
    
          return {
            content: [
              {
                type: 'text',
                text: services.helpers.formatJson(receipt)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error fetching transaction receipt ${txHash}: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Underlying service function that uses viem's public client to fetch the transaction receipt from the blockchain.
    export async function getTransactionReceipt(hash: Hash, network = 'ethereum'): Promise<TransactionReceipt> {
      const client = getPublicClient(network);
      return await client.getTransactionReceipt({ 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