get_latest_blockhash
Retrieve the most recent block hash from the Solana blockchain ledger to verify or synchronize transactions and block data.
Instructions
Returns the latest block hash from the ledger.
Returns: str: Latest blockhash in the format "Latest blockhash: {blockhash}"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.py:201-211 (handler)The main handler function for the get_latest_blockhash tool. It is decorated with @mcp.tool() which registers it with the MCP server. The function creates an AsyncClient to the Solana RPC, fetches the latest blockhash, and returns a formatted string.@mcp.tool() async def get_latest_blockhash() -> str: """Returns the latest block hash from the ledger. Returns: str: Latest blockhash in the format "Latest blockhash: {blockhash}" """ async with AsyncClient(rpc_url) as client: blockhash = await client.get_latest_blockhash() return f"Latest blockhash: {blockhash}"