Skip to main content
Glama

get_transaction

Retrieve detailed transaction data, including sender, recipient, value, and more, by inputting a transaction hash. Works across multiple Ethereum-compatible networks via EVM MCP Server.

Instructions

Get detailed information about a specific transaction by its hash. Includes sender, recipient, value, data, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkNoNetwork name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', 'polygon') or chain ID. Defaults to Ethereum mainnet.
txHashYesThe transaction hash to look up (e.g., '0x1234...')

Implementation Reference

  • The async handler function that implements the 'get_transaction' tool. It takes txHash and optional network, fetches the transaction using services.getTransaction, formats it as JSON, and returns it in the MCP response format. Handles errors gracefully.
    async ({ txHash, network = "ethereum" }) => {
      try {
        const tx = await services.getTransaction(txHash as Hash, network);
        return { content: [{ type: "text", text: services.helpers.formatJson(tx) }] };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Error fetching transaction: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true
        };
      }
    }
  • The tool schema defining input parameters (txHash required, network optional), description, and annotations indicating it's read-only and idempotent.
    {
      description: "Get transaction details by transaction hash",
      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",
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true
      }
    },
  • The MCP server.registerTool call that registers the 'get_transaction' tool, specifying its name, schema, and handler function within the registerEVMTools function.
    server.registerTool(
      "get_transaction",
      {
        description: "Get transaction details by transaction hash",
        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",
          readOnlyHint: true,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: true
        }
      },
      async ({ txHash, network = "ethereum" }) => {
        try {
          const tx = await services.getTransaction(txHash as Hash, network);
          return { content: [{ type: "text", text: services.helpers.formatJson(tx) }] };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error fetching transaction: ${error instanceof Error ? error.message : String(error)}` }],
            isError: true
          };
        }
      }
    );
  • Supporting helper function from services that performs the actual RPC call to retrieve transaction details using viem's PublicClient.
    export async function getTransaction(hash: Hash, network = 'ethereum') {
      const client = getPublicClient(network);
      return await client.getTransaction({ hash });
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what data is included (sender, recipient, value, data) without disclosing behavioral aspects like error handling, rate limits, authentication requirements, or whether this is a read-only operation. It provides basic output content but misses critical operational context.

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 perfectly concise with two sentences that directly convey purpose and scope without any wasted words. It's front-loaded with the core functionality and efficiently lists included data points.

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

Completeness3/5

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

For a read operation with 100% schema coverage but no annotations or output schema, the description adequately covers purpose and output content but lacks behavioral transparency and usage differentiation. It's minimally viable but has clear gaps in operational context.

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?

Schema description coverage is 100%, so the schema already fully documents both parameters (network and txHash). The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score for high schema coverage.

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

Purpose5/5

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

The description clearly states the specific action ('Get detailed information') and resource ('about a specific transaction by its hash'), with explicit differentiation from siblings like get_transaction_receipt (which focuses on receipt data) and get_block_by_number (which focuses on blocks). It precisely identifies the tool's scope.

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

Usage Guidelines3/5

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

The description implies usage when transaction details are needed, but provides no explicit guidance on when to use this tool versus alternatives like get_transaction_receipt (for receipt-specific data) or get_latest_block (for block context). It lacks when-not-to-use instructions or prerequisite information.

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