Skip to main content
Glama
0xReisearch

REI Crypto MCP Server

by 0xReisearch

get_closest_block

Find the blockchain block nearest to a specific UNIX timestamp for a given cryptocurrency chain identifier.

Instructions

GET /coins/block/{chain}/{timestamp}

Get the closest block to a timestamp.

Parameters:
    chain: chain identifier
    timestamp: UNIX timestamp to find closest block for

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainYes
timestampYes

Implementation Reference

  • The main handler function for the 'get_closest_block' MCP tool. It uses the shared 'make_request' helper to query the DefiLlama API endpoint '/coins/block/{chain}/{timestamp}' and returns the closest block number for the given chain and timestamp as a string.
    @mcp.tool()
    async def get_closest_block(chain: str, timestamp: int) -> str:
        """GET /coins/block/{chain}/{timestamp}
        
        Get the closest block to a timestamp.
        
        Parameters:
            chain: chain identifier
            timestamp: UNIX timestamp to find closest block for
        """
        result = await make_request('GET', f'/coins/block/{chain}/{timestamp}')
        return str(result)

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/0xReisearch/crypto-mcp-beta'

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