Skip to main content
Glama
jackdark425

Financial Modeling Prep (FMP) MCP Server

by jackdark425

get_historical_chart

Retrieve historical stock price data with customizable time intervals to analyze market trends and performance over specific periods.

Instructions

Get historical price data with flexible time intervals

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock ticker symbol
intervalYesTime interval
fromNoStart date in YYYY-MM-DD format (optional)
toNoEnd date in YYYY-MM-DD format (optional)

Implementation Reference

  • The 'get_historical_chart' tool is registered and implemented here, using the HistoricalChartSchema for input validation and calling fetchFMP to retrieve data.
    server.registerTool(
      'get_historical_chart',
      {
        description: 'Get historical price data with flexible time intervals',
        inputSchema: HistoricalChartSchema,
      },
      async (args: z.infer<typeof HistoricalChartSchema>) => {
        try {
          let endpoint = `/historical-chart/${args.interval}?symbol=${args.symbol.toUpperCase()}`;
          if (args.from) endpoint += `&from=${args.from}`;
          if (args.to) endpoint += `&to=${args.to}`;
          const data = await fetchFMP<HistoricalPrice[]>(endpoint);
          return jsonResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • Validation schema for the input arguments of the get_historical_chart tool.
    const HistoricalChartSchema = z.object({
      symbol: z.string().describe('Stock ticker symbol'),
      interval: IntervalSchema.describe('Time interval'),
      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)'),
    });
  • Tool registration function that includes the get_historical_chart tool definition.
    export function registerTechnicalTools(server: any) {
      // RSI
      server.registerTool(
        'get_technical_indicator_rsi',
        {
          description: 'Get Relative Strength Index (RSI) technical indicator',
          inputSchema: TechnicalIndicatorSchema,
        },
        async (args: z.infer<typeof TechnicalIndicatorSchema>) => {
          try {
            const period = args.period || 14;
            const data = await fetchFMP<TechnicalIndicator[]>(
              `/technical-indicators/rsi?symbol=${args.symbol.toUpperCase()}&timeframe=${args.timeframe}&periodLength=${period}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // SMA
      server.registerTool(
        'get_technical_indicator_sma',
        {
          description: 'Get Simple Moving Average (SMA) technical indicator',
          inputSchema: TechnicalIndicatorSchema,
        },
        async (args: z.infer<typeof TechnicalIndicatorSchema>) => {
          try {
            const period = args.period || 10;
            const data = await fetchFMP<TechnicalIndicator[]>(
              `/technical-indicators/sma?symbol=${args.symbol.toUpperCase()}&timeframe=${args.timeframe}&periodLength=${period}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // EMA
      server.registerTool(
        'get_technical_indicator_ema',
        {
          description: 'Get Exponential Moving Average (EMA) technical indicator',
          inputSchema: TechnicalIndicatorSchema,
        },
        async (args: z.infer<typeof TechnicalIndicatorSchema>) => {
          try {
            const period = args.period || 10;
            const data = await fetchFMP<TechnicalIndicator[]>(
              `/technical-indicators/ema?symbol=${args.symbol.toUpperCase()}&timeframe=${args.timeframe}&periodLength=${period}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Historical Chart
      server.registerTool(
        'get_historical_chart',
        {
          description: 'Get historical price data with flexible time intervals',
          inputSchema: HistoricalChartSchema,
        },
        async (args: z.infer<typeof HistoricalChartSchema>) => {
          try {
            let endpoint = `/historical-chart/${args.interval}?symbol=${args.symbol.toUpperCase()}`;
            if (args.from) endpoint += `&from=${args.from}`;
            if (args.to) endpoint += `&to=${args.to}`;
            const data = await fetchFMP<HistoricalPrice[]>(endpoint);
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but provides minimal behavioral insight. It mentions 'flexible time intervals' but doesn't disclose rate limits, authentication needs, data freshness, or output format. This leaves significant gaps for a tool that likely involves external data fetching.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core purpose ('Get historical price data') and adds a useful qualifier ('with flexible time intervals'). Every part earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 4 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the output contains (e.g., price points, timestamps), error conditions, or behavioral constraints, leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds little beyond implying time-based filtering, but doesn't explain parameter interactions or default behaviors (e.g., what happens if 'from'/'to' are omitted). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get historical price data') and resource ('price data'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'get_quote' or 'get_technical_indicator_*' which might also provide price-related data, missing explicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description mentions 'flexible time intervals' but doesn't specify use cases, prerequisites, or exclusions compared to siblings like 'get_quote' for current prices or technical indicators for derived metrics.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jackdark425/aigroup-fmp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server