Skip to main content
Glama

eth_getFeeHistory

Retrieve historical gas fee data to estimate EIP-1559 transaction costs. Specify block range and priority fee percentiles for accurate fee prediction.

Instructions

Get historical gas fee data for EIP-1559 fee estimation.

Args:

  • blockCount (string): Number of blocks to analyze as hex (e.g., '0x4' for 4 blocks).

  • newestBlock (string): Latest block to include ('latest', 'pending', or hex block number).

  • rewardPercentiles (array): Percentiles for priority fee sampling (e.g., [25, 50, 75]).

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

Returns:

  • Object with baseFeePerGas array, gasUsedRatio array, oldestBlock, and reward matrix.

Examples:

  • "Get last 4 blocks fee history": { "blockCount": "0x4", "newestBlock": "latest", "rewardPercentiles": [25, 50, 75] }

  • "Query Sepolia fees": { "blockCount": "0xa", "newestBlock": "latest", "rewardPercentiles": [10, 50, 90], "network": "sepolia" }

Errors:

  • InvalidParams: When blockCount format, newestBlock, or rewardPercentiles are invalid.

  • InternalError: When Infura API is unavailable or returns an error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockCountYesThe number of blocks to check.
newestBlockYesThe latest block number or tag (e.g., 'latest').
rewardPercentilesYesA list of percentiles for gas rewards.
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?

With no annotations, the description fully discloses behavior: it is a read-only historical query, returns specific fields (baseFeePerGas, gasUsedRatio, etc.), lists possible errors (InvalidParams, InternalError), and mentions the underlying API (Infura). This provides sufficient transparency for safe usage.

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-organized into sections (Args, Returns, Examples, Errors), concise with no wasted words, and front-loaded with the main purpose. Examples provide concrete usage patterns. Every sentence adds value.

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

Completeness4/5

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

The description covers purpose, parameter formats, return structure, examples, and errors. It lacks mention of the response_format parameter (though schema covers it), but otherwise is complete for a read-only tool with no output schema. The examples aid in understanding complex parameters like rewardPercentiles.

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%, but the description adds meaningful details beyond the schema: blockCount requires hex format (e.g., '0x4'), newestBlock can be 'latest', 'pending', or hex, rewardPercentiles is an array of numbers, and network defaults to 'mainnet'. Examples further clarify parameter use. The response_format parameter is not described, but schema already covers it.

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 'Get historical gas fee data for EIP-1559 fee estimation.' This specifies the action (get), resource (historical gas fee data), and context (for EIP-1559 fee estimation), distinguishing it from siblings like eth_getGasPrice which returns current gas price.

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 for fee estimation, but provides no explicit guidance on when to use this tool versus alternatives (e.g., eth_getGasPrice for current price, other eth_call for data). No when-not-to-use or exclusion criteria are given.

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