Skip to main content
Glama
tywenk

Model Context Protocol Server for Solana Client

by tywenk

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

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

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