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}"
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_latest_blockhash"
}
}Input 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}"