Skip to main content
Glama
tywenk

Model Context Protocol Server for Solana Client

by tywenk

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
NameRequiredDescriptionDefault
end_slotNo
start_slotYes

Implementation Reference

  • 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()

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/tywenk/mcp-sol'

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