Skip to main content
Glama

eth_getTransactionByBlockNumberAndIndex

Retrieve a transaction by its position within a block using block number and transaction index. Returns details including hash, from, to, value, and gas.

Instructions

Retrieves a transaction by its position within a specific block using block number and transaction index.

Args:

  • blockNumber (string): Block number as hex (e.g., '0x10d4f') or tag ('latest', 'earliest', 'pending')

  • transactionIndex (string): Zero-based position of the transaction in the block as hex (e.g., '0x0')

  • network (string, optional): Ethereum network to query, defaults to 'mainnet'

Returns:

  • Transaction object with hash, from, to, value, gas, gasPrice, input, nonce, blockHash, blockNumber, transactionIndex; null if not found

Examples:

  • "Get first transaction in latest block": { "blockNumber": "latest", "transactionIndex": "0x0" }

  • "Get transaction at index 5 in specific block": { "blockNumber": "0x10d4f", "transactionIndex": "0x5" }

Errors:

  • InvalidParams: When blockNumber or transactionIndex format is invalid

  • InternalError: When Infura API is unavailable

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockNumberYesThe block number or tag (latest, earliest, pending).
transactionIndexYesThe transaction index position.
networkNoThe Ethereum network to query, e.g., 'mainnet' or 'sepolia'.mainnet
response_formatNoOutput format: 'json' for structured data, 'markdown' for human-readable.json
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses return values (transaction object or null), lists possible errors, and provides examples. However, it does not explicitly state the operation is read-only or safe, which would be helpful.

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 well-structured with clear sections (main description, args, returns, examples, errors). Every sentence is useful and the information is front-loaded.

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

Completeness5/5

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

Given no output schema, the description fully explains return values and errors. Schema coverage is 100% and examples cover typical use cases, making the tool complete for an agent to use.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3. The description adds value by explaining blockNumber as hex or tag, transactionIndex as zero-based hex, and providing examples. This goes beyond the schema descriptions.

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 tool retrieves a transaction by its position within a specific block using block number and index, distinguishing it from siblings like eth_getTransactionByHash or eth_getTransactionByBlockHashAndIndex.

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

Usage Guidelines4/5

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

The description includes examples showing when to use it (with block number or tag) but does not explicitly state when not to use it or provide alternatives. The sibling list implies alternatives, but explicit guidance is missing.

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/Qbandev/infura-mcp-server'

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