Skip to main content
Glama

eth_getTransactionReceipt

Retrieve transaction receipt details including status, gas used, and logs to verify transaction execution and outcomes on EVM-compatible blockchains.

Instructions

Returns the receipt of a transaction by transaction hash

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
txHashYesTransaction hash

Implementation Reference

  • The complete server.tool registration which defines the handler function for the 'eth_getTransactionReceipt' tool. The handler takes a txHash, calls the RPC method via makeRPCCall, formats the response using formatResponse, and handles errors.
    server.tool(
      "eth_getTransactionReceipt",
      "Returns the receipt of a transaction by transaction hash",
      {
        txHash: z.string().describe("Transaction hash"),
      },
      async ({ txHash }) => {
        try {
          const result = await makeRPCCall("eth_getTransactionReceipt", [txHash]);
          if (!result) {
            return {
              content: [
                {
                  type: "text",
                  text: `Transaction receipt not found: ${txHash}`,
                },
              ],
            };
          }
    
          return {
            content: [
              {
                type: "text",
                text: formatResponse(result, "Transaction Receipt"),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${error.message}`,
              },
            ],
          };
        }
      },
    );
  • Input schema for the tool, defining 'txHash' as a required string parameter.
    {
      txHash: z.string().describe("Transaction hash"),
    },
  • Shared helper function makeRPCCall used by the eth_getTransactionReceipt handler to perform the actual RPC call to the Ethereum provider.
    async function makeRPCCall(method: string, params: any[] = []): Promise<any> {
      try {
        const result = await provider.send(method, params);
        return result;
      } catch (error: any) {
        throw new Error(`RPC call failed: ${error.message}`);
      }
    }
  • Shared helper function formatResponse used to format the tool output in markdown.
    function formatResponse(data: any, title: string): string {
      let result = `**${title}**\n\n`;
    
      if (typeof data === "object" && data !== null) {
        if (Array.isArray(data)) {
          // Handle arrays
          result += `**Count:** ${data.length}\n\n`;
          data.forEach((item, index) => {
            result += `**${index + 1}.**\n`;
            if (typeof item === "object" && item !== null) {
              result += formatObject(item, "  ");
            } else {
              result += `  ${item}\n`;
            }
            result += "\n";
          });
        } else {
          // Handle objects
          result += formatObject(data, "");
        }
      } else {
        result += `${data}\n`;
      }
    
      return result;
    }
    
    // Helper function to format objects recursively
    function formatObject(obj: any, indent: string): string {
      let result = "";
    
      for (const [key, value] of Object.entries(obj)) {
        if (typeof value === "object" && value !== null) {
          if (Array.isArray(value)) {
            result += `${indent}**${key}:** [${value.length} items]\n`;
            if (value.length > 0 && value.length <= 10) {
              value.forEach((item, index) => {
                if (typeof item === "object" && item !== null) {
                  result += `${indent}  ${index}: ${JSON.stringify(item, null, 2).replace(/\n/g, "\n" + indent + "    ")}\n`;
                } else {
                  result += `${indent}  ${index}: ${item}\n`;
                }
              });
            }
          } else {
            result += `${indent}**${key}:**\n`;
            result += formatObject(value, indent + "  ");
          }
        } else {
          result += `${indent}**${key}:** ${value}\n`;
        }
      }
    
      return result;
    }
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 tool returns a receipt but does not clarify what a receipt entails (e.g., success status, gas used, logs), whether it's read-only, or any rate limits or error conditions. This leaves significant gaps in understanding the tool's behavior.

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, direct sentence with zero waste, clearly stating the tool's function without unnecessary details. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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 lack of annotations and output schema, the description is incomplete. It does not explain what a transaction receipt includes (e.g., success indicators, gas details) or potential errors, which are crucial for a tool in a complex domain like blockchain transactions. More context is needed for effective use.

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 schema description coverage is 100%, with the parameter 'txHash' well-documented in the schema. The description adds no additional meaning beyond implying the hash is used to fetch the receipt, aligning with the baseline score when the schema handles parameter documentation effectively.

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 action ('Returns') and resource ('receipt of a transaction'), making the purpose evident. However, it does not explicitly differentiate from sibling tools like 'eth_getTransactionByHash', which might retrieve different transaction details, leaving room for slight ambiguity.

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?

No guidance is provided on when to use this tool versus alternatives, such as 'eth_getTransactionByHash' for raw transaction data or other siblings for different blockchain queries. The description lacks context on prerequisites or exclusions, offering minimal usage direction.

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

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

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