Skip to main content
Glama
covalenthq

GoldRush MCP Server

by covalenthq

block_heights

Retrieve block heights and timestamps for historical blockchain analysis by specifying a date range and blockchain network.

Instructions

Commonly used to get all the block heights within a particular date range. Requires chainName (blockchain network), startDate (YYYY-MM-DD format), and endDate (YYYY-MM-DD or 'latest'). Optional pagination parameters include pageSize (default 10) and pageNumber (default 0). Returns block heights, timestamps, and related data for blocks within the specified date range, useful for historical analysis and time-based blockchain queries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNameYesThe blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet').
startDateYesStart date for the query in YYYY-MM-DD format (e.g., '2023-01-01').
endDateYesEnd date for the query in YYYY-MM-DD format or 'latest' for current date.
pageSizeNoNumber of block heights to return per page. Default is 10, maximum is 100.
pageNumberNoPage number for pagination, starting from 0. Default is 0.

Implementation Reference

  • The "block_heights" tool definition and handler implementation in BaseService.ts. It registers the tool with the MCP server, defines the input schema using Zod, and executes the logic by calling 'goldRushClient.BaseService.getBlockHeightsByPage'.
    server.tool(
        "block_heights",
        "Commonly used to get all the block heights within a particular date range. " +
            "Requires chainName (blockchain network), startDate (YYYY-MM-DD format), and endDate (YYYY-MM-DD or 'latest'). " +
            "Optional pagination parameters include pageSize (default 10) and pageNumber (default 0). " +
            "Returns block heights, timestamps, and related data for blocks within the specified date range, " +
            "useful for historical analysis and time-based blockchain queries.",
        {
            chainName: z
                .enum(Object.values(ChainName) as [string, ...string[]])
                .describe(
                    "The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')."
                ),
            startDate: z
                .string()
                .describe(
                    "Start date for the query in YYYY-MM-DD format (e.g., '2023-01-01')."
                ),
            endDate: z
                .union([z.string(), z.literal("latest")])
                .describe(
                    "End date for the query in YYYY-MM-DD format or 'latest' for current date."
                ),
            pageSize: z
                .number()
                .optional()
                .default(10)
                .describe(
                    "Number of block heights 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.getBlockHeightsByPage(
                        params.chainName as Chain,
                        params.startDate,
                        params.endDate,
                        {
                            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,
                };
            }
        }
    );

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