Skip to main content
Glama

get_transaction_receipt

Retrieve transaction details by hash from Ethereum and 30+ compatible networks using the EVM MCP Server, enabling efficient blockchain data access for integrations.

Instructions

Get a transaction receipt by its hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork name or chain ID. Defaults to Ethereum mainnet.
txHashYesThe transaction hash to look up

Implementation Reference

  • Full registration of the 'get_transaction_receipt' MCP tool, including input schema, annotations, and inline handler function that uses viem's public client to fetch the transaction receipt.
    server.registerTool(
      "get_transaction_receipt",
      {
        description: "Get transaction receipt (confirmation status, gas used, logs). Use this to check if a transaction has been confirmed.",
        inputSchema: {
          txHash: z.string().describe("Transaction hash (0x...)"),
          network: z.string().optional().describe("Network name or chain ID. Defaults to Ethereum mainnet.")
        },
        annotations: {
          title: "Get Transaction Receipt",
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: true
        }
      },
      async ({ txHash, network = "ethereum" }) => {
        try {
          const client = await services.getPublicClient(network);
          const receipt = await client.getTransactionReceipt({
            hash: txHash as Hash
          });
          return { content: [{ type: "text", text: services.helpers.formatJson(receipt) }] };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error fetching transaction receipt: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true
          };
        }
      }
    );
  • The inline handler function that implements the core logic: fetches public client, calls getTransactionReceipt with the hash, formats the receipt as JSON, and returns it in the MCP response format. Handles errors gracefully.
    async ({ txHash, network = "ethereum" }) => {
      try {
        const client = await services.getPublicClient(network);
        const receipt = await client.getTransactionReceipt({
          hash: txHash as Hash
        });
        return { content: [{ type: "text", text: services.helpers.formatJson(receipt) }] };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Error fetching transaction receipt: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true
        };
      }
    }
  • Tool metadata including description, Zod input schema validating txHash (required string) and network (optional string), and annotations indicating read-only, idempotent behavior.
    {
      description: "Get transaction receipt (confirmation status, gas used, logs). Use this to check if a transaction has been confirmed.",
      inputSchema: {
        txHash: z.string().describe("Transaction hash (0x...)"),
        network: z.string().optional().describe("Network name or chain ID. Defaults to Ethereum mainnet.")
      },
      annotations: {
        title: "Get Transaction Receipt",
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true
      }
    },
  • Helper utility function to get transaction receipt, wrapping viem client call. Not directly used by the tool handler but provides the same functionality.
     * Get a transaction receipt by hash for a specific network
     */
    export async function getTransactionReceipt(hash: Hash, network = 'ethereum'): Promise<TransactionReceipt> {
      const client = getPublicClient(network);
      return await client.getTransactionReceipt({ hash });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Get') but doesn't describe what a transaction receipt contains, whether it's a read-only operation (implied but not explicit), error conditions (e.g., invalid hash), rate limits, or authentication needs. For a tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and appropriately sized for a simple lookup tool, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a blockchain transaction receipt tool with no annotations and no output schema), the description is incomplete. It doesn't explain what a receipt includes (e.g., status, gas used), potential errors, or return format. For a tool that likely returns structured data, this leaves significant gaps in understanding its behavior and output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'by its hash', which aligns with the 'txHash' parameter in the schema. However, with 100% schema description coverage, the schema already documents both parameters ('txHash' and 'network') clearly. The description adds minimal value beyond the schema, meeting the baseline of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get a transaction receipt by its hash' specifies the verb ('Get'), resource ('transaction receipt'), and key identifier ('by its hash'). It distinguishes from sibling tools like 'get_transaction' (which likely returns transaction details rather than receipt) and 'get_block_by_number' (different resource). However, it doesn't explicitly differentiate from all siblings, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when this is appropriate (e.g., for confirming transaction completion) versus when to use 'get_transaction' or other siblings, nor does it specify prerequisites or exclusions. This lack of context leaves usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/mcpdotdirect/evm-mcp-server'

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