helius_get_block_height
Retrieve the current block height of Solana to track blockchain progress or synchronize operations.
Instructions
Get the block height of the Solana blockchain
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": "helius_get_block_height"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitment | No |
Implementation Reference
- src/handlers/helius.ts:64-71 (handler)Handler function that executes the getBlockHeight logic by calling Helius SDK's connection.getBlockHeight and returning a success or error response.
export const getBlockHeightHandler = async (input: GetBlockHeightInput): Promise<ToolResultSchema> => { try { const blockHeight = await (helius as any as Helius).connection.getBlockHeight(input.commitment); return createSuccessResponse(`Block height: ${blockHeight}`); } catch (error) { return createErrorResponse(`Error getting block height: ${error instanceof Error ? error.message : String(error)}`); } } - src/handlers/helius.types.ts:12-14 (schema)Input type definition for GetBlockHeight, accepting an optional commitment parameter.
export type GetBlockHeightInput = { commitment?: "confirmed" | "finalized" | "processed"; } - src/tools.ts:45-55 (registration)Registration of the 'helius_get_block_height' tool in the tools array with its name, description, and input schema.
{ name: "helius_get_block_height", description: "Get the block height of the Solana blockchain", inputSchema: { type: "object", properties: { commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] } }, required: [] } }, - src/tools.ts:551-551 (registration)Mapping of the tool name 'helius_get_block_height' to its handler function in the handlers dictionary.
"helius_get_block_height": getBlockHeightHandler, - src/handlers/helius-mock.ts:98-101 (helper)Mock implementation of getBlockHeight for testing, returning a fixed block height of 123456789.
getBlockHeight: async () => { return 123456789; },