get_solana_block_height
Retrieve current Solana blockchain block height to monitor network status and synchronize applications with the distributed ledger.
Instructions
Get the latest Solana block height
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- src/handlers/solana-handlers.ts:392-406 (handler)Handler logic for executing the get_solana_block_height tool. Extracts network parameter and delegates to SolanaService.getBlockHeight, then formats the response.case 'get_solana_block_height': { const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await solanaService.getBlockHeight(network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Core implementation of block height retrieval. Gets the Solana RPC service for the network and calls the 'getBlockHeight' RPC method./** * Get latest block height */ async getBlockHeight( network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { const service = this.blockchainService.getServiceByBlockchain('solana', network); if (!service) { return { success: false, error: `Solana service not found for ${network}`, }; } return this.blockchainService.callRPCMethod(service.id, 'getBlockHeight', []); }
- Input schema definition for the get_solana_block_height tool, specifying optional network parameter.{ name: 'get_solana_block_height', description: 'Get the latest Solana block height', inputSchema: { type: 'object', properties: { network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, }, },
- src/index.ts:97-97 (registration)Registers the Solana tools, including get_solana_block_height, with the MCP server....registerSolanaHandlers(server, solanaService),