从Financial Modeling Prep获取、验证并引用准确的公司财务数据,包括报价、公司概况、报表、比率、估值、历史记录等。
Instructional knowledge that teaches an AI agent how to use the Financial Modeling Prep (FMP) financial-data API correctly, safely, and with rigor. This is guidance, not executable code.
financialmodelingprep — "Use FMP for company financial data: quotes, profiles, statements, ratios, key metrics, valuation, price history, and calendars."
Teach the agent to retrieve, ground, and cite financial data from FMP. The agent must:
The agent's value is accuracy and traceability, not opinion. Treat every figure as something a user could audit against the API response.
Use FMP when the user asks for:
Prefer FMP when the task is fundamental analysis, screening inputs, or grounded company snapshots.
Do not use FMP (or stop and explain the limitation) when:
When out of scope, say so plainly and suggest the correct alternative rather than forcing FMP.
FMP_API_KEY — required. The API key for FMP. Read it from the environment at call time.apikey query parameter (or header where supported) on every request.https://financialmodelingprep.com/stable/Never hardcode, print, log, or echo the key. Never include it in citations, examples, error messages, or output shown to the user. See §15.
The financialmodelingprep-mcp server is complete and live-tested: it exposes 12 tools —
eleven focused tools for common workflows plus one generic passthrough ( fmp_request) that reaches
all 263 FMP /stable endpoints. Prefer the MCP tools when present; the HTTP column shows the
underlying endpoint for direct-GET fallback.
#OperationMCP toolHTTP endpoint ( /stable/...)1Symbol/name search (auto symbol→name fallback)fmp_search``/search-symbol?query=, /search-name?query=2Quotefmp_quote``/quote?symbol=3Company profilefmp_company_profile``/profile?symbol=4Income statementfmp_income_statement``/income-statement?symbol=&period=&limit=5Balance sheetfmp_balance_sheet``/balance-sheet-statement?symbol=&period=&limit=6Cash flowfmp_cash_flow``/cash-flow-statement?symbol=&period=&limit=7Ratiosfmp_ratios``/ratios?symbol=&period=&limit=8Key metricsfmp_key_metrics``/key-metrics?symbol=&period=&limit=9Valuation (DCF)fmp_dcf``/discounted-cash-flow?symbol=10Historical prices (EOD)fmp_historical_prices``/historical-price-eod/full?symbol=&from=&to=11Company screenerfmp_screener``/company-screener?...12Anything else (263 endpoints)fmp_requestany /stable/<endpoint> (e.g. treasury-rates, dividends, senate-trading, news/stock-latest)
Common parameters: period ∈ annual | quarter; limit controls how many periods/rows return;
from/ to are YYYY-MM-DD. The server validates inputs, preserves as-of dates, redacts the key, and
surfaces typed errors ( auth, validation, rate_limit, plan_restricted, timeout, server).
fmp_request tool (full 263-endpoint surface)#Tools 1–11 cover the common equity-research path. fmp_request is the escape hatch for the entire
rest of FMP — treasury rates, dividends, stock splits, insider trading, senate/house trading, ETF
holdings, economic indicators, news, earnings-call transcripts, and the long tail of the 263
/stable endpoints.
Inputs: endpoint (the path after /stable/, validated to a safe path shape) and an optional
params object of query parameters.
json
{ "endpoint": "treasury-rates", "params": { "from": "2025-01-01", "to": "2025-03-31" } }
{ "endpoint": "dividends", "params": { "symbol": "AAPL" } }
{ "endpoint": "senate-trading", "params": { "symbol": "AAPL" } }
{ "endpoint": "news/stock-latest", "params": { "limit": 20 } }
When to prefer a dedicated tool. If a dedicated tool exists for what you need — quote, profile,
income statement, balance sheet, cash flow, ratios, key metrics, DCF, historical prices, screener, or
search — use it instead of fmp_request. Dedicated tools add input validation, output
normalization (e.g. as-of fields), and clearer errors. Reach for fmp_request only when no dedicated
tool fits.
Catalog. The complete endpoint list with parameters and response shapes lives in the API docs at
api-docs/09-all-endpoints/ (search & directory, company & profile, quotes, prices & history,
metrics/valuation/analyst, ownership/SEC/government, ETFs & funds, screeners & movers). Consult it to
pick the right endpoint and params rather than guessing.
All numeric-integrity, citation, freshness, security, and compliance rules below apply equally to data
returned by fmp_request.
Never pull data for a guessed ticker. Tickers are ambiguous (e.g. "Apple" vs "Applied"; same name on multiple exchanges; ADRs).
Resolve symbols with fmp_search first. Before any quote/statement/metric call, run fmp_search
to turn a name or fuzzy ticker into a canonical symbol. fmp_search already tries
/search-symbol and automatically falls back to /search-name, so a single call handles both a
partial ticker and a company name. Use the resolved symbol for every downstream tool.
AAPL) and you are confident, you may proceed — but still verify against the profile.fmp_search (which queries /search-name / /search-symbol).symbol, name, exchange/ exchangeShortName, currency.symbol./profile?symbol= — confirm companyName, exchange, and currency match the user's intent before reporting numbers.Document the resolved symbol explicitly in the answer ("Resolved 'Apple' → AAPL on NASDAQ, USD").
/quote?symbol=<TICKER> (or fmp_quote).price, change, changePercentage, dayLow, dayHigh, marketCap, volume, previousClose, timestamp/ exchange.Example phrasing: "AAPL last price 192.34 USD (delayed quote, as of ). Source: FMP /quote."
Resolve the symbol (§7).
Choose the statement endpoint: income, balance sheet, or cash flow.
Choose the period explicitly (this applies to fmp_income_statement, fmp_balance_sheet,
fmp_cash_flow, fmp_ratios, and fmp_key_metrics):
period=annual for fiscal-year data — use for year-over-year trends, long histories, and "last
N years" requests.period=quarter for quarterly data — use for recent momentum, seasonality, the latest reported
quarter, or to build a TTM from the last four quarters.annual when the user does not specify; switch to quarter only when the question is
about recent/quarterly performance.Choose limit to control how many periods come back (e.g. limit=5 for 5 years/quarters). Larger limits cost more and may exceed plan history.
Identify each row's identity fields: date, period (e.g. FY, Q1), calendarYear/ fiscalYear, filingDate, acceptedDate, reportedCurrency.
TTM (trailing twelve months): if the user wants TTM, use a dedicated TTM endpoint/metric if available, or sum the last four quarters — and label it "TTM" and state the four periods used. Never present a single annual figure as TTM.
Currency: always report reportedCurrency. Do not convert currencies unless asked, and if you do, cite the rate and source separately.
Cite every number with symbol + period + filingDate (§12).
Verification needed: confirm whether a separate TTM endpoint exists or whether TTM is a field within
/key-metrics//ratios.
/discounted-cash-flow?symbol=<TICKER>.dcf (estimated intrinsic value per share) and the comparison price ( Stock Price / price field).These are non-negotiable.
null/missing, say "not reported" rather than guessing.Every reported number must be traceable. For each figure or block, cite:
/income-statement, /quote).FY2024, Q1 2025, or "annual/quarterly") for statements/metrics.acceptedDate for statement data (when the filing was made).Example citation: "Revenue 391.0B USD — FY2024 income statement, filingDate 2024-11-01, reportedCurrency USD (FMP). Data as of latest available filing; a newer period may exist."
Prefer giving the user enough to re-query: symbol, endpoint, period.
ConditionMeaning / typed errorCorrect agent reaction{"Error Message":"..."} / validationRequest rejected / bad argumentsRead the message; fix the request (param/symbol/date/endpoint). Do not present partial/garbage data.HTTP 401 / "invalid api key" / account suspended ( auth)Auth problemDo not retry. Stop, tell the user the key is invalid/suspended and must be fixed. Never expose the key.HTTP 402 ( plan_restricted)Endpoint not included in the current plan (e.g. fmp_screener or some fmp_request endpoints on lower tiers)Do not retry — retrying never helps. Tell the user plainly that this endpoint requires a higher FMP plan, name the endpoint, and offer an alternative the current plan can answer if one exists.HTTP 429 ( rate_limit)Rate/quota limit hitBack off (wait/retry with delay) and cache; reduce call volume. Inform the user if limited. Do not hammer.Empty array []No dataLikely wrong symbol or not covered by the plan (e.g. non-US on free tier). Re-resolve the symbol or explain coverage limits.Timeout / 5xx ( timeout / server)TransientRetry a small number of times with backoff; if persistent, report the outage. (For wide price ranges, narrow from/ to.)
Rule of thumb: fix-don't-retry for 401/suspended and 402/plan_restricted (a higher plan is needed); back-off-and-cache for 429; re-resolve for empty results.
Verification needed: confirm current free-tier call limits and coverage at https://site.financialmodelingprep.com/developer/docs
limit — request only the periods you need.FMP_API_KEY — not in answers, logs, citations, examples, code blocks, or error text.apikey=YOUR_FMP_API_KEY — never the real value.Before answering any FMP request, confirm:
FMP_API_KEY is available and never exposed.period (annual/quarter/TTM) chosen and labeled.reportedCurrency shown for every figure.fmp_search to resolve the symbol; used a dedicated tool where one exists, fmp_request only for the long tail.limit right-sized.A. "What's Apple trading at?"
AAPL; confirm via /profile?symbol=AAPL (NASDAQ, USD)./quote?symbol=AAPL./quote."B. "Show me Microsoft's revenue and net income for the last 3 years."
MSFT (NASDAQ, USD); confirm via profile./income-statement?symbol=MSFT&period=annual&limit=3.date/ period, revenue, netIncome, reportedCurrency, filingDate. Label as annual. Note data as-of latest filing.C. "Is Tesla undervalued?"
TSLA; confirm profile./discounted-cash-flow?symbol=TSLA → dcf vs market price.fmp_request when a dedicated tool exists (loses validation/normalization).[] as "value is zero" instead of "no data / wrong symbol / not covered"./stable/ base; older /api/v3/ paths may differ. Re-verify endpoints against the docs periodically.financialmodelingprep-mcp server currently exposes 12 tools (11 dedicated + fmp_request).
Tool names and the endpoint surface may evolve; confirm against the server's tool list and the
full catalog in api-docs/09-all-endpoints/.