getDividendAdjustedChart
Retrieve dividend-adjusted price and volume data for any stock over a date range to analyze performance with dividend distributions accounted for.
Instructions
Analyze stock performance with dividend adjustments using the FMP Dividend-Adjusted Price Chart API. Access end-of-day price and volume data that accounts for dividend payouts, offering a more comprehensive view of stock trends over time.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock symbol | |
| from_date | No | Start date (YYYY-MM-DD) | |
| to | No | End date (YYYY-MM-DD) |
Implementation Reference
- src/tools/chart.ts:106-134 (registration)Registration of the 'getDividendAdjustedChart' tool on the MCP server with its schema (symbol, from_date, to) and handler callback.
server.tool( "getDividendAdjustedChart", "Analyze stock performance with dividend adjustments using the FMP Dividend-Adjusted Price Chart API. Access end-of-day price and volume data that accounts for dividend payouts, offering a more comprehensive view of stock trends over time.", { symbol: z.string().describe("Stock symbol"), from_date: z.string().optional().describe("Start date (YYYY-MM-DD)"), to: z.string().optional().describe("End date (YYYY-MM-DD)"), }, async ({ symbol, from_date: from, to }) => { try { const results = await chartClient.getDividendAdjustedChart(symbol, from, to); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } } ); - src/tools/chart.ts:114-133 (handler)Handler function for getDividendAdjustedChart - destructures the input, calls chartClient.getDividendAdjustedChart, and returns the result as JSON text content.
async ({ symbol, from_date: from, to }) => { try { const results = await chartClient.getDividendAdjustedChart(symbol, from, to); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } } - src/tools/chart.ts:109-113 (schema)Input schema for the tool defining three parameters: symbol (required string), from_date (optional string), to (optional string).
{ symbol: z.string().describe("Stock symbol"), from_date: z.string().optional().describe("Start date (YYYY-MM-DD)"), to: z.string().optional().describe("End date (YYYY-MM-DD)"), }, - src/api/chart/ChartClient.ts:95-109 (helper)ChartClient.getDividendAdjustedChart API method that makes the actual HTTP GET request to '/historical-price-eod/dividend-adjusted' endpoint with symbol, from, to parameters.
async getDividendAdjustedChart( symbol: string, from?: string, to?: string, options?: { signal?: AbortSignal; context?: FMPContext; } ): Promise<UnadjustedChartData[]> { return super.get<UnadjustedChartData[]>( "/historical-price-eod/dividend-adjusted", { symbol, from, to }, options ); } - src/api/chart/types.ts:23-31 (schema)Type definition for UnadjustedChartData - the data shape returned by getDividendAdjustedChart (symbol, date, adjOpen, adjHigh, adjLow, adjClose, volume).
export interface UnadjustedChartData { symbol: string; date: string; adjOpen: number; adjHigh: number; adjLow: number; adjClose: number volume: number; }