helius_get_epoch_info
Retrieve current epoch details from Solana, including epoch number, slot index, and start slot, with optional commitment level.
Instructions
Get information about the current epoch
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_epoch_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitment | No |
Implementation Reference
- src/handlers/helius.ts:272-279 (handler)getEpochInfoHandler: The actual implementation that calls connection.getEpochInfo() and returns the epoch info.
export const getEpochInfoHandler = async (input: GetEpochInfoInput): Promise<ToolResultSchema> => { try { const epochInfo = await (helius as any as Helius).connection.getEpochInfo(input.commitment); return createSuccessResponse(`Epoch info: ${JSON.stringify(epochInfo, null, 2)}`); } catch (error) { return createErrorResponse(`Error getting epoch info: ${error instanceof Error ? error.message : String(error)}`); } } - src/handlers/helius.types.ts:130-132 (schema)GetEpochInfoInput type definition with optional commitment parameter.
export type GetEpochInfoInput = { commitment?: "confirmed" | "finalized" | "processed"; } - src/tools.ts:220-230 (registration)Tool registration entry: defines name 'helius_get_epoch_info', description, and inputSchema with optional commitment.
{ name: "helius_get_epoch_info", description: "Get information about the current epoch", inputSchema: { type: "object", properties: { commitment: { type: "string", enum: ["confirmed", "finalized", "processed"] } }, required: [] } }, - src/tools.ts:566-566 (registration)Maps the tool name 'helius_get_epoch_info' to getEpochInfoHandler in the handler lookup object.
"helius_get_epoch_info": getEpochInfoHandler, - src/handlers/utils.ts:23-46 (helper)createErrorResponse and createSuccessResponse helper functions used by the handler.
export const createErrorResponse = (message: string): ToolResultSchema => { return { content: [{ type: "text", text: message }], isError: true }; }; /** * Utility function to create a success response * @param message The success message * @returns A ToolResultSchema with the success message */ export const createSuccessResponse = (message: string): ToolResultSchema => { return { content: [{ type: "text", text: message }], isError: false }; };