get_blocks
Retrieve a list of confirmed blocks between specified Solana blockchain slots using the MCP server. Ideal for analyzing transaction history or verifying block data.
Instructions
Returns a list of confirmed blocks between two slots.
Args: start_slot (int): Start slot as u64 integer end_slot (Optional[int], optional): End slot as u64 integer. Defaults to None.
Returns: str: List of blocks in the format "Blocks: {blocks}"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end_slot | No | ||
| start_slot | Yes |
Implementation Reference
- src/server.py:89-102 (handler)The main handler function for the 'get_blocks' MCP tool. It is decorated with @mcp.tool() for registration and implements the tool logic by querying the Solana RPC client for blocks between the given slots and returning a formatted string.@mcp.tool() async def get_blocks(start_slot: int, end_slot: Optional[int] = None) -> str: """Returns a list of confirmed blocks between two slots. Args: start_slot (int): Start slot as u64 integer end_slot (Optional[int], optional): End slot as u64 integer. Defaults to None. Returns: str: List of blocks in the format "Blocks: {blocks}" """ async with AsyncClient(rpc_url) as client: blocks = await client.get_blocks(start_slot, end_slot) return f"Blocks: {blocks}"
- src/server.py:89-89 (registration)The @mcp.tool() decorator registers the get_blocks function as an MCP tool.@mcp.tool()