get_analyst_estimates
Retrieve analyst financial estimates for stocks including revenue and EPS forecasts to support investment research and analysis.
Instructions
Get analyst financial estimates for a stock (revenue, EPS forecasts)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock ticker symbol | |
| period | No | Period type (annual or quarter) | |
| limit | No | Number of periods to return (default: 10) |
Implementation Reference
- src/tools/analysis.ts:45-56 (handler)The async handler function that executes the logic for 'get_analyst_estimates', fetching data from the FMP API.
async (args: z.infer<typeof AnalystEstimatesSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 10; const data = await fetchFMP<AnalystEstimate[]>( `/analyst-estimates?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } - src/tools/analysis.ts:14-18 (schema)The input validation schema (AnalystEstimatesSchema) for the 'get_analyst_estimates' tool.
const AnalystEstimatesSchema = z.object({ symbol: SymbolSchema.describe('Stock ticker symbol'), period: PeriodSchema.describe('Period type (annual or quarter)'), limit: LimitSchema.describe('Number of periods to return (default: 10)'), }); - src/tools/analysis.ts:39-57 (registration)Registration of the 'get_analyst_estimates' tool within the server instance.
server.registerTool( 'get_analyst_estimates', { description: 'Get analyst financial estimates for a stock (revenue, EPS forecasts)', inputSchema: AnalystEstimatesSchema, }, async (args: z.infer<typeof AnalystEstimatesSchema>) => { try { const period = args.period || 'annual'; const limit = args.limit || 10; const data = await fetchFMP<AnalystEstimate[]>( `/analyst-estimates?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}` ); return jsonResponse(data); } catch (error) { return errorResponse(error); } } );