get_earnings_calendar
Retrieve upcoming earnings announcement dates for companies to track financial reporting schedules and plan investment research.
Instructions
Get upcoming earnings announcements calendar
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | No | Start date in YYYY-MM-DD format (optional) | |
| to | No | End date in YYYY-MM-DD format (optional) |
Implementation Reference
- src/tools/calendar.ts:32-43 (handler)The async handler function that executes the logic for the get_earnings_calendar tool by fetching data from the FMP API.
async (args: z.infer<typeof DateRangeSchema>) => { try { const params: string[] = []; if (args.from) params.push(`from=${args.from}`); if (args.to) params.push(`to=${args.to}`); const endpoint = '/earnings-calendar' + (params.length ? `?${params.join('&')}` : ''); const data = await fetchFMP<EarningsCalendar[]>(endpoint); return jsonResponse(data); } catch (error) { return errorResponse(error); } } - src/tools/calendar.ts:25-44 (registration)Registration of the get_earnings_calendar tool within the server instance.
// Earnings Calendar server.registerTool( 'get_earnings_calendar', { description: 'Get upcoming earnings announcements calendar', inputSchema: DateRangeSchema, }, async (args: z.infer<typeof DateRangeSchema>) => { try { const params: string[] = []; if (args.from) params.push(`from=${args.from}`); if (args.to) params.push(`to=${args.to}`); const endpoint = '/earnings-calendar' + (params.length ? `?${params.join('&')}` : ''); const data = await fetchFMP<EarningsCalendar[]>(endpoint); return jsonResponse(data); } catch (error) { return errorResponse(error); } } ); - src/tools/calendar.ts:10-13 (schema)Input schema definition for the get_earnings_calendar tool using Zod.
const DateRangeSchema = z.object({ from: z.string().optional().describe('Start date in YYYY-MM-DD format (optional)'), to: z.string().optional().describe('End date in YYYY-MM-DD format (optional)'), });