get_dcf_valuation
Calculate discounted cash flow (DCF) or levered DCF valuations for stocks by inputting the valuation type and stock symbol. Access accurate financial valuation data via the Yahoo Finance MCP Server.
Instructions
获取 DCF 或杠杆 DCF 估值数据。
参数说明: valuation_type: str dcf 或 levered symbol: str 股票代码
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | ||
| valuation_type | Yes |
Implementation Reference
- server.py:489-498 (registration)Registration of the 'get_dcf_valuation' tool using the @fmp_server.tool decorator, including name and description with parameter details.@fmp_server.tool( name="get_dcf_valuation", description="""获取 DCF 或杠杆 DCF 估值数据。 参数说明: valuation_type: str dcf 或 levered symbol: str 股票代码""", )
- server.py:499-522 (handler)The main handler function that fetches DCF or levered DCF valuation data from the Financial Modeling Prep API based on the provided valuation_type and symbol.async def get_dcf_valuation(valuation_type: str, symbol: str) -> str: """根据类型获取 DCF 估值""" api_key = os.environ.get("FMP_API_KEY") if not api_key: return "Error: FMP_API_KEY environment variable not set." base = "https://financialmodelingprep.com/stable" endpoint_map = { "dcf": "discounted-cash-flow", "levered": "levered-discounted-cash-flow", } endpoint = endpoint_map.get(valuation_type.lower()) if not endpoint: return "Error: invalid valuation type" url = f"{base}/{endpoint}" try: resp = requests.get(url, params={"symbol": symbol, "apikey": api_key}, timeout=10) resp.raise_for_status() data = resp.json() except Exception as e: return f"Error: getting {valuation_type} DCF for {symbol}: {e}" return json.dumps(data)