get_block_time
Retrieve the estimated production time of a specific block on the Solana blockchain by providing its slot number. Returns the block time in a clear, formatted string.
Instructions
Fetch the estimated production time of a block.
Args: slot (int): Block slot number
Returns: str: Block time in the format "Block time: {time}"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slot | Yes |
Implementation Reference
- src/server.py:74-86 (handler)The handler function for the 'get_block_time' tool. It uses AsyncClient to fetch the block time for a given slot from the Solana RPC and formats the response as a string. The @mcp.tool() decorator registers it as an MCP tool.@mcp.tool() async def get_block_time(slot: int) -> str: """Fetch the estimated production time of a block. Args: slot (int): Block slot number Returns: str: Block time in the format "Block time: {time}" """ async with AsyncClient(rpc_url) as client: time = await client.get_block_time(slot) return f"Block time: {time}"