# How to Retrieve Transaction Details Using the Arbitrum MCP Server

> Easily retrieve transaction details on Arbitrum using the MCP server. Invoke the get transaction tool with a hash and RPC URL for swift on-chain data retrieval via eth_getTransactionByHash.

- Repository: [Dewansh/arbitrum-mcp](https://github.com/dewanshparashar/arbitrum-mcp)
- Tags: how-to-guide
- Published: 2026-02-28

---

**Invoke the `get_transaction` tool with a transaction hash and either a chain name or RPC URL to fetch on-chain details via the `eth_getTransactionByHash` JSON-RPC method.**

The `dewanshparashar/arbitrum-mcp` repository provides a Model-Context-Protocol (MCP) server that exposes Ethereum-compatible blockchain data through standardized tools. When you need to retrieve transaction details using the Arbitrum MCP Server, the implementation follows a precise sequence of RPC resolution, client instantiation, and structured data parsing.

## Understanding the `get_transaction` Tool Architecture

The `get_transaction` tool is defined in the server's tool dispatcher and orchestrates three primary components to resolve blockchain data. Understanding this architecture helps you debug failures and optimize integration patterns.

### RPC Endpoint Resolution

Before fetching data, the server must determine which RPC endpoint to query. In [`src/index.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/index.ts) (lines 70-86), the `resolveRpcUrl()` function implements a priority-based resolution strategy:

1. **Direct URL**: If the request provides an `rpcUrl` argument starting with `http://` or `https://`, it uses that value directly.
2. **Chain Name Lookup**: If a `chainName` argument is provided (e.g., `"arbitrum-one"`), the server queries the `ChainLookupService` defined in [`src/services/chain-lookup.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/services/chain-lookup.ts) (lines 54-78) to resolve the canonical RPC URL.
3. **Default Fallback**: If neither argument is present, the server falls back to its configured `defaultRpcUrl`.

### Transaction Retrieval

Once the RPC URL is resolved, the server instantiates `EthereumAccountClient` from [`src/clients/ethereum-account-client.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/clients/ethereum-account-client.ts). This client wraps the standard Ethereum JSON-RPC interface and handles hexadecimal normalization.

The critical method is `getTransaction(txHash)`, implemented at lines 55-74, which:

- Constructs a JSON-RPC payload calling `eth_getTransactionByHash`
- Executes the HTTP POST request via `makeRpcCall`
- Parses hexadecimal fields (`nonce`, `blockNumber`, `transactionIndex`, `value`, `gas`, `gasPrice`) into native JavaScript types
- Returns a structured `Transaction` object or throws if the hash is not found

## Step-by-Step Implementation Flow

When you invoke the `get_transaction` tool, the Arbitrum MCP Server executes this precise sequence:

1. **Request Validation**: The server receives a `CallTool` request with `name: "get_transaction"` and arguments containing `txHash` (required) and optionally `chainName` or `rpcUrl`.

2. **Endpoint Resolution**: The `resolveRpcUrl()` function determines the target RPC endpoint using the priority logic described above, potentially querying `ChainLookupService` for named chains.

3. **Client Initialization**: The server creates a new `EthereumAccountClient` instance: `const client = new EthereumAccountClient(rpcUrl);`

4. **Data Fetching**: The client calls `eth_getTransactionByHash` via `client.getTransaction(txHash)`, normalizing hexadecimal values to numbers and strings.

5. **Response Formatting**: The server wraps the result in a Model-Context-Protocol text content block: `JSON.stringify(tx, null, 2)` and returns it to the caller.

If the transaction hash does not exist on the specified chain, the `EthereumAccountClient` throws an error that propagates to the caller as a tool execution failure.

## Practical Code Example: Fetching Transactions Programmatically

While the MCP server exposes `get_transaction` via the protocol interface, you can also use the underlying client classes directly in your TypeScript applications. This example demonstrates how to retrieve transaction details using the same components the server uses internally:

```typescript
import { EthereumAccountClient } from "./src/clients/ethereum-account-client.js";
import { ChainLookupService } from "./src/services/chain-lookup.js";

/**
 * Retrieve transaction details from Arbitrum or any EVM chain.
 *
 * @param txHash - The transaction hash (0x...)
 * @param chainOrUrl - Either a chain name (e.g., "arbitrum-one") or a full RPC URL
 */
async function fetchTransactionDetails(txHash: string, chainOrUrl: string) {
  // Initialize the chain lookup service to resolve named chains
  const lookup = ChainLookupService.getInstance();
  
  let rpcUrl: string;
  
  // Determine if we received a URL or a chain name
  if (chainOrUrl.startsWith("http://") || chainOrUrl.startsWith("https://")) {
    rpcUrl = chainOrUrl;
  } else {
    const chain = await lookup.findChainByName(chainOrUrl);
    if (!chain?.rpcUrl) {
      throw new Error(`Unknown chain "${chainOrUrl}"`);
    }
    rpcUrl = chain.rpcUrl;
  }

  // Instantiate the Ethereum client with the resolved endpoint
  const client = new EthereumAccountClient(rpcUrl);
  
  // Fetch and normalize the transaction data
  const transaction = await client.getTransaction(txHash);
  
  console.log("Transaction details:", JSON.stringify(transaction, null, 2));
  return transaction;
}

// Example usage:
fetchTransactionDetails(
  "0x5e0a6d6f5c2e7b6a9c8d3e8c2f3b4a6c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4",
  "arbitrum-one"
).catch(console.error);

```

To run this example, ensure you have the `arbitrum-mcp` repository cloned and dependencies installed:

```bash
npm install
npx ts-node fetch-transaction.ts

```

## Key Source Files and Implementation Details

Understanding the specific source files helps you debug issues or extend functionality when you retrieve transaction details using the Arbitrum MCP Server.

| File | Purpose | Key Lines |
|------|---------|-----------|
| [`src/index.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/index.ts) | Main request router; handles the `"get_transaction"` tool case, resolves RPC URLs, and formats JSON responses. | [70-86](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/index.ts#L70-L86) |
| [`src/clients/ethereum-account-client.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/clients/ethereum-account-client.ts) | Low-level RPC client implementing `getTransaction(txHash)`, which sends `eth_getTransactionByHash` requests and normalizes hexadecimal responses. | [55-74](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/clients/ethereum-account-client.ts#L55-L74) |
| [`src/services/chain-lookup.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/services/chain-lookup.ts) | Resolves human-readable chain names (e.g., `"arbitrum-one"`) to canonical RPC URLs via the `ChainLookupService`. | [54-78](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/services/chain-lookup.ts#L54-L78) |

## Summary

- The Arbitrum MCP Server exposes transaction retrieval through the **`get_transaction`** tool, which wraps the standard Ethereum `eth_getTransactionByHash` JSON-RPC method.
- **RPC endpoint resolution** follows a priority chain: explicit URL > named chain lookup via `ChainLookupService` > default server configuration.
- The **`EthereumAccountClient`** class in [`src/clients/ethereum-account-client.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/clients/ethereum-account-client.ts) handles hexadecimal normalization, converting raw RPC responses into structured JavaScript objects.
- You can interact with the tool via the Model-Context-Protocol interface or instantiate the client classes directly for programmatic access.

## Frequently Asked Questions

### What parameters does the `get_transaction` tool require?

The tool requires **`txHash`** (the transaction hash as a hex string starting with `0x`). Optionally, you can provide either **`chainName`** (e.g., `"arbitrum-one"`) or **`rpcUrl`** (a full HTTP endpoint) to specify which network to query. If neither is provided, the server uses its default RPC configuration.

### How does the Arbitrum MCP Server handle invalid transaction hashes?

If the transaction hash does not exist on the specified chain, the `EthereumAccountClient.getTransaction()` method throws an error indicating the transaction was not found. This error propagates through the MCP server and returns to the caller as a tool execution failure with the error message, allowing you to handle missing transactions gracefully in your application logic.

### Can I use a custom RPC URL instead of a named chain?

Yes. The `resolveRpcUrl()` function in [`src/index.ts`](https://github.com/dewanshparashar/arbitrum-mcp/blob/main/src/index.ts) checks if the provided argument starts with `http://` or `https://`. If so, it uses that URL directly instead of querying the `ChainLookupService`. This allows you to point the tool at private RPC endpoints, local development nodes, or alternative infrastructure providers without modifying the server's chain configuration.

### What transaction fields are returned by the `get_transaction` tool?

The tool returns a structured `Transaction` object containing standard Ethereum fields including **`hash`**, **`nonce`**, **`blockHash`**, **`blockNumber`**, **`transactionIndex`**, **`from`**, **`to`**, **`value`**, **`gas`**, **`gasPrice`**, and **`input`**. The `EthereumAccountClient` normalizes hexadecimal values to JavaScript numbers and strings, making the data immediately usable without manual parsing.