Skip to main content
Glama
covalenthq

GoldRush MCP Server

by covalenthq

log_events_by_topic

Query event logs by topic hash across all contracts on a blockchain network for cross-sectional analysis and tracking specific event types.

Instructions

Commonly used to get all event logs of the same topic hash across all contracts within a particular chain. Useful for cross-sectional analysis of event logs that are emitted on-chain.Requires chainName (blockchain network) and topicHash (the event signature hash). Optional parameters include block range (startingBlock, endingBlock), secondaryTopics for filtering by additional parameters, and pagination settings (pageSize default 10, pageNumber default 0). Returns decoded event logs matching the specified topic hash, ideal for tracking specific event types across multiple contracts on a blockchain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNameYesThe blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet').
topicHashYesThe event signature hash (topic[0]) to search for. This is the keccak256 hash of the event signature.
startingBlockNoStarting block number to begin search from. Use with endingBlock to define a range.
endingBlockNoEnding block number to search until. Use with startingBlock to define a range.
secondaryTopicsNoAdditional topic filters (topic[1], topic[2], topic[3]) to narrow down the search.
pageSizeNoNumber of log events to return per page. Default is 10, maximum is 100.
pageNumberNoPage number for pagination, starting from 0. Default is 0.

Implementation Reference

  • Registration and handler implementation for the 'log_events_by_topic' tool, which uses the Covalent GoldRush client to fetch log events by topic hash.
    server.tool(
        "log_events_by_topic",
        "Commonly used to get all event logs of the same topic hash across all contracts within a particular chain. " +
            "Useful for cross-sectional analysis of event logs that are emitted on-chain." +
            "Requires chainName (blockchain network) and topicHash (the event signature hash). " +
            "Optional parameters include block range (startingBlock, endingBlock), secondaryTopics for " +
            "filtering by additional parameters, and pagination settings (pageSize default 10, pageNumber default 0). " +
            "Returns decoded event logs matching the specified topic hash, ideal for tracking specific " +
            "event types across multiple contracts on a blockchain.",
        {
            chainName: z
                .enum(Object.values(ChainName) as [string, ...string[]])
                .describe(
                    "The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')."
                ),
            topicHash: z
                .string()
                .describe(
                    "The event signature hash (topic[0]) to search for. This is the keccak256 hash of the event signature."
                ),
            startingBlock: z
                .union([z.string(), z.number()])
                .optional()
                .describe(
                    "Starting block number to begin search from. Use with endingBlock to define a range."
                ),
            endingBlock: z
                .union([z.string(), z.number()])
                .optional()
                .describe(
                    "Ending block number to search until. Use with startingBlock to define a range."
                ),
            secondaryTopics: z
                .string()
                .optional()
                .describe(
                    "Additional topic filters (topic[1], topic[2], topic[3]) to narrow down the search."
                ),
            pageSize: z
                .number()
                .optional()
                .default(10)
                .describe(
                    "Number of log events to return per page. Default is 10, maximum is 100."
                ),
            pageNumber: z
                .number()
                .optional()
                .default(0)
                .describe(
                    "Page number for pagination, starting from 0. Default is 0."
                ),
        },
        async (params) => {
            try {
                const response =
                    await goldRushClient.BaseService.getLogEventsByTopicHashByPage(
                        params.chainName as Chain,
                        params.topicHash,
                        {
                            startingBlock: params.startingBlock,
                            endingBlock: params.endingBlock,
                            secondaryTopics: params.secondaryTopics,
                            pageSize: params.pageSize,
                            pageNumber: params.pageNumber,
                        }
                    );
                return {
                    content: [
                        {
                            type: "text",
                            text: stringifyWithBigInt(response.data),
                        },
                    ],
                };
            } catch (err) {
                return {
                    content: [{ type: "text", text: `Error: ${err}` }],
                    isError: true,
                };
            }
        }
    );
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses that logs are 'decoded' and specifies pagination defaults, but omits critical behavioral traits: safety profile (read-only vs destructive), rate limits, maximum block range constraints, or performance characteristics of cross-contract queries.

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

Conciseness3/5

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

Contains necessary information but suffers from slight redundancy ('Useful for cross-sectional analysis' vs 'ideal for tracking') and formatting issues (missing space after 'on-chain.Requires'). Information is not perfectly front-loaded, though length is appropriate for the 7-parameter complexity.

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?

Lacks output schema, yet description only briefly mentions 'Returns decoded event logs' without describing the structure, fields, or format of returned events. Given the complexity of blockchain event data, the return value description is insufficient for an agent to predict output structure.

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%, establishing baseline 3. Description adds value by contextualizing parameters as a cohesive workflow ('Requires chainName... and topicHash... Optional parameters include...'), reinforcing the relationship between block range parameters, and emphasizing the 'across all contracts' scope that parameter selection enables.

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

Purpose4/5

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

Clearly states the tool retrieves event logs by topic hash across all contracts on a specific chain, with specific verbs and scope. However, it does not explicitly distinguish from sibling tool 'log_events_by_address' (which filters by address rather than topic), missing the opportunity to clarify selection criteria.

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?

Provides implied usage context ('Commonly used for cross-sectional analysis'), suggesting when it might be useful. However, lacks explicit guidance on when NOT to use it or when to prefer alternatives like log_events_by_address for address-specific queries.

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/covalenthq/goldrush-mcp-server'

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