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}"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"slot": "<slot>"
},
"name": "get_block_time"
}
}Input 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}"