get_block_height
Retrieve the current block height from a Solana node using the MCP Server. This tool provides blockchain data in the format 'Block height: {height}'.
Instructions
Returns the current block height of the node.
Returns: str: Current block height in the format "Block height: {height}"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.py:62-71 (handler)The handler function decorated with @mcp.tool(), implementing the get_block_height tool by querying the Solana RPC client for the current block height and returning a formatted string response.@mcp.tool() async def get_block_height() -> str: """Returns the current block height of the node. Returns: str: Current block height in the format "Block height: {height}" """ async with AsyncClient(rpc_url) as client: height = await client.get_block_height() return f"Block height: {height}"
- src/server.py:62-62 (registration)The @mcp.tool() decorator registers the get_block_height function as an MCP tool.@mcp.tool()