Skip to main content
Glama

eth_getLogs

Retrieve and filter event logs emitted by smart contracts. Supports block range, contract address, and topic filters with pagination.

Instructions

Query event logs emitted by smart contracts with flexible filters. Supports pagination for large result sets.

Args:

  • fromBlock (string): Start block as hex (e.g., '0x10d4f') or tag ('latest', 'earliest', 'pending').

  • toBlock (string): End block as hex or tag.

  • address (string, optional): Contract address to filter logs from.

  • topics (array, optional): Array of 32-byte topic filters for indexed event parameters.

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

  • limit (integer, optional): Maximum logs to return (1-10000). Defaults to 1000.

  • offset (integer, optional): Number of logs to skip for pagination. Defaults to 0.

Returns:

  • Object with 'logs' array and 'pagination' metadata (total, count, offset, limit, has_more, next_offset).

Examples:

  • "Get all logs in block range": { "fromBlock": "0x10d4f", "toBlock": "0x10d50" }

  • "Filter by contract and topic": { "fromBlock": "latest", "toBlock": "latest", "address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"] }

  • "Paginate results": { "fromBlock": "0x10d4f", "toBlock": "0x10d50", "limit": 100, "offset": 0 }

Errors:

  • InvalidParams: When block tags or address format is invalid.

  • InternalError: When query range is too large or Infura API fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromBlockYesThe starting block number or block identifier.
toBlockYesThe ending block number or block identifier.
addressNoThe address of the contract to filter logs.
topicsNoAn array of topics to filter logs.
networkNoThe Ethereum network to query, e.g., 'mainnet' or 'sepolia'.mainnet
limitNoMaximum number of logs to return (default: 1000, max: 10000). Use with offset for pagination.
offsetNoNumber of logs to skip for pagination (default: 0).
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 carries the burden of behavioral disclosure. It explains that logs are queried with filters, pagination is supported, return format includes logs and pagination metadata, and lists possible errors. It does not explicitly state that the operation is read-only, but that is implicit. Overall, it provides sufficient transparency for an agent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with separate sections for Args, Returns, Examples, and Errors. The first sentence succinctly states the core purpose. While the description is lengthy, every section adds value and there is no redundancy. It is appropriately detailed for the tool's complexity.

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 the tool's complexity (8 parameters, pagination, error handling) and the absence of an output schema, the description is remarkably complete. It covers all parameters, return format including pagination metadata, error conditions, and provides multiple examples. No significant gaps remain.

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

Parameters5/5

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

The input schema has 100% coverage and the description adds substantial context beyond it. For example, it explains that fromBlock and toBlock accept hex or tags like 'latest', that topics are 32-byte filters, that network defaults to 'mainnet', and provides concrete examples for each parameter. This greatly aids correct parameter usage.

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's purpose: querying event logs from smart contracts with flexible filters. It explicitly includes support for pagination, which distinguishes it from other Ethereum tools that do not return logs, such as eth_call or eth_getTransactionByHash. The description is precise and action-oriented.

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 provides clear usage guidelines through examples and parameter explanations, including pagination for large result sets and filtering by address or topics. However, it does not explicitly contrast with sibling tools or state when not to use this tool. The information is present but could be more directive.

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