Skip to main content
Glama
jackdark425

Financial Modeling Prep (FMP) MCP Server

by jackdark425

get_financial_ratios

Analyze company financial health by retrieving profitability, liquidity, and efficiency ratios for any stock symbol over specified periods.

Instructions

Get detailed financial ratios (profitability, liquidity, efficiency)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock ticker symbol
periodNoPeriod type (annual or quarter)
limitNoNumber of periods to return (default: 5)

Implementation Reference

  • Handler implementation for the 'get_financial_ratios' tool.
    server.registerTool(
      'get_financial_ratios',
      {
        description: 'Get detailed financial ratios (profitability, liquidity, efficiency)',
        inputSchema: FinancialStatementSchema,
      },
      async (args: z.infer<typeof FinancialStatementSchema>) => {
        try {
          const period = args.period || 'annual';
          const limit = args.limit || 5;
          const data = await fetchFMP(
            `/ratios?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}`
          );
          return jsonResponse(data);
        } catch (error) {
          return errorResponse(error);
        }
      }
    );
  • Input schema definition for financial statement tools, including 'get_financial_ratios'.
    const FinancialStatementSchema = 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: 5)'),
    });
  • Registration function where the 'get_financial_ratios' tool is registered with the server.
    export function registerFinancialsTools(server: any) {
      // Company Profile
      server.registerTool(
        'get_company_profile',
        {
          description: 'Get detailed company profile information including description, industry, sector, CEO, and more',
          inputSchema: CompanyProfileSchema,
        },
        async (args: z.infer<typeof CompanyProfileSchema>) => {
          try {
            const data = await fetchFMP<CompanyProfile[]>(`/profile?symbol=${args.symbol.toUpperCase()}`);
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Income Statement
      server.registerTool(
        'get_income_statement',
        {
          description: 'Get company income statement (annual or quarterly)',
          inputSchema: FinancialStatementSchema,
        },
        async (args: z.infer<typeof FinancialStatementSchema>) => {
          try {
            const period = args.period || 'annual';
            const limit = args.limit || 5;
            const data = await fetchFMP<IncomeStatement[]>(
              `/income-statement?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Balance Sheet
      server.registerTool(
        'get_balance_sheet',
        {
          description: 'Get company balance sheet statement (annual or quarterly)',
          inputSchema: FinancialStatementSchema,
        },
        async (args: z.infer<typeof FinancialStatementSchema>) => {
          try {
            const period = args.period || 'annual';
            const limit = args.limit || 5;
            const data = await fetchFMP<BalanceSheet[]>(
              `/balance-sheet-statement?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Cash Flow
      server.registerTool(
        'get_cash_flow',
        {
          description: 'Get company cash flow statement (annual or quarterly)',
          inputSchema: FinancialStatementSchema,
        },
        async (args: z.infer<typeof FinancialStatementSchema>) => {
          try {
            const period = args.period || 'annual';
            const limit = args.limit || 5;
            const data = await fetchFMP<CashFlow[]>(
              `/cash-flow-statement?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Stock News
      server.registerTool(
        'get_stock_news',
        {
          description: 'Get latest news articles for a stock symbol',
          inputSchema: StockNewsSchema,
        },
        async (args: z.infer<typeof StockNewsSchema>) => {
          try {
            const limit = args.limit || 10;
            const data = await fetchFMP(`/news/stock?symbols=${args.symbol.toUpperCase()}&limit=${limit}`);
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Key Metrics
      server.registerTool(
        'get_key_metrics',
        {
          description: 'Get key financial metrics (P/E, ROE, debt ratios, etc.)',
          inputSchema: FinancialStatementSchema,
        },
        async (args: z.infer<typeof FinancialStatementSchema>) => {
          try {
            const period = args.period || 'annual';
            const limit = args.limit || 5;
            const data = await fetchFMP(
              `/key-metrics?symbol=${args.symbol.toUpperCase()}&period=${period}&limit=${limit}`
            );
            return jsonResponse(data);
          } catch (error) {
            return errorResponse(error);
          }
        }
      );
    
      // Financial Ratios
      server.registerTool(
        'get_financial_ratios',
        {
          description: 'Get detailed financial ratios (profitability, liquidity, efficiency)',
          inputSchema: FinancialStatementSchema,
        },
        async (args: z.infer<typeof FinancialStatementSchema>) => {
          try {
            const period = args.period || 'annual';
            const limit = args.limit || 5;
            const data = await fetchFMP(
              `/ratios?symbol=${args.symbol.toUpperCase()}&period=${period}&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 'gets' data (implying a read-only operation) but doesn't mention any behavioral traits like rate limits, authentication requirements, data freshness, error conditions, or response format. For a financial data tool with no annotation coverage, this leaves significant gaps in understanding how it behaves.

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 extremely concise—a single, efficient sentence that front-loads the core purpose. Every word earns its place: 'Get' (action), 'detailed' (quality), 'financial ratios' (resource), and the parenthetical examples (profitability, liquidity, efficiency) add useful specificity without verbosity.

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 moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks context about when to use it, behavioral details, or output information. With no output schema, the description doesn't explain what 'detailed financial ratios' actually returns, leaving the agent to guess the response structure.

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 the schema fully documents all three parameters (symbol, period, limit). The description doesn't add any parameter-specific information beyond what's in the schema—it doesn't explain what 'financial ratios' include or how they relate to the parameters. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't need to.

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 detailed financial ratios (profitability, liquidity, efficiency)'. It specifies the verb ('Get') and resource ('financial ratios') with categories, making it clear what data is retrieved. However, it doesn't explicitly differentiate from sibling tools like 'get_key_metrics' or 'get_balance_sheet', which might also provide related 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. With many sibling tools available (like get_key_metrics, get_balance_sheet, get_income_statement), there's no indication of what makes this tool unique or when it's preferred over others. The user must infer usage from the tool name and parameters alone.

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