Skip to main content
Glama
jackdark425

Financial Modeling Prep (FMP) MCP Server

by jackdark425

get_analyst_ratings

Retrieve analyst ratings and upgrades/downgrades for any stock to inform investment decisions and track market sentiment.

Instructions

Get analyst ratings and upgrades/downgrades for a stock

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock ticker symbol

Implementation Reference

  • The handler for 'get_analyst_ratings' that fetches analyst ratings data from the FMP API using the '/grades' endpoint.
    server.registerTool(
      'get_analyst_ratings',
      {
        description: 'Get analyst ratings and upgrades/downgrades for a stock',
        inputSchema: SymbolOnlySchema,
      },
      async (args: z.infer<typeof SymbolOnlySchema>) => {
        try {
          const data = await fetchFMP<AnalystRating[]>(`/grades?symbol=${args.symbol.toUpperCase()}`);
          return jsonResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • The input schema for 'get_analyst_ratings' defined using Zod.
    const SymbolOnlySchema = z.object({
      symbol: SymbolSchema.describe('Stock ticker symbol'),
    });
  • The registration function for analyst tools, including 'get_analyst_ratings'.
    export function registerAnalysisTools(server: any) {
      // Analyst Estimates
      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);
          }
        }
      );
    
      // Price Target
      server.registerTool(
        'get_price_target',
        {
          description: 'Get analyst price target summary for a stock',
          inputSchema: SymbolOnlySchema,
        },
        async (args: z.infer<typeof SymbolOnlySchema>) => {
          try {
            const data = await fetchFMP<PriceTarget[]>(`/price-target-summary?symbol=${args.symbol.toUpperCase()}`);
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Analyst Ratings
      server.registerTool(
        'get_analyst_ratings',
        {
          description: 'Get analyst ratings and upgrades/downgrades for a stock',
          inputSchema: SymbolOnlySchema,
        },
        async (args: z.infer<typeof SymbolOnlySchema>) => {
          try {
            const data = await fetchFMP<AnalystRating[]>(`/grades?symbol=${args.symbol.toUpperCase()}`);
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Insider Trading
      server.registerTool(
        'get_insider_trading',
        {
          description: 'Get recent insider trading activity for a stock',
          inputSchema: InsiderTradingSchema,
        },
        async (args: z.infer<typeof InsiderTradingSchema>) => {
          try {
            const limit = args.limit || 100;
            const data = await fetchFMP<InsiderTrading[]>(
              `/insider-trading/search?symbol=${args.symbol.toUpperCase()}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Institutional Holders
      server.registerTool(
        'get_institutional_holders',
        {
          description: 'Get institutional ownership (13F filings) for a stock',
          inputSchema: InstitutionalHoldersSchema,
        },
        async (args: z.infer<typeof InstitutionalHoldersSchema>) => {
          try {
            const limit = args.limit || 100;
            const data = await fetchFMP<InstitutionalHolder[]>(
              `/institutional-ownership/latest?symbol=${args.symbol.toUpperCase()}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get'), implying a read-only operation, but doesn't cover aspects like authentication requirements, rate limits, data freshness, or error handling. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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: 'Get analyst ratings and upgrades/downgrades for a stock'. It is front-loaded with the core purpose, contains no redundant information, and every word contributes to understanding the tool's function without waste.

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

Completeness3/5

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

Given the tool's complexity (simple read operation with one parameter), 100% schema description coverage, and no output schema, the description is minimally adequate. It states what data is retrieved but lacks details on output format, data scope (e.g., time range, number of analysts), or integration with sibling tools, leaving room for improvement in completeness.

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?

The input schema has 100% description coverage, with the 'symbol' parameter documented as 'Stock ticker symbol'. The description adds no additional parameter semantics beyond this, such as format examples (e.g., 'AAPL' for Apple) or constraints. With high schema coverage, a baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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 tool's purpose: 'Get analyst ratings and upgrades/downgrades for a stock'. It specifies the verb ('Get'), resource ('analyst ratings and upgrades/downgrades'), and target ('for a stock'). However, it doesn't explicitly differentiate from sibling tools like 'get_analyst_estimates' or 'get_price_target', which might provide related but distinct financial data.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_analyst_estimates' (which might focus on earnings estimates rather than ratings) or 'get_price_target' (which could include price targets from analysts), leaving the agent to infer usage context without explicit direction.

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