Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_price_target_info

Retrieve analyst price target details, including summaries, consensus views, or related news for a specific stock symbol. Customize results by selecting page and limit for precise data retrieval.

Instructions

获取分析师目标价相关信息,可选择汇总、共识或新闻。

参数说明: info_type: str summary、consensus、news、latest_news symbol: str 股票代码,news/summary/consensus 必填 page: int 页码,默认 0 limit: int 返回数量,默认 10

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
info_typeYes
limitNo
pageNo
symbolNo

Implementation Reference

  • The main handler function for the 'get_price_target_info' tool. It fetches analyst price target information (summary, consensus, news, or latest news) from the Financial Modeling Prep API based on the provided info_type and optional symbol, page, and limit parameters.
    async def get_price_target_info(
        info_type: str,
        symbol: str = "",
        page: int = 0,
        limit: int = 10,
    ) -> str:
        """获取价格目标汇总、共识或相关新闻"""
    
        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 = {
            "summary": "price-target-summary",
            "consensus": "price-target-consensus",
            "news": "price-target-news",
            "latest_news": "price-target-latest-news",
        }
        endpoint = endpoint_map.get(info_type.lower())
        if not endpoint:
            return "Error: invalid info type"
    
        params = {"apikey": api_key}
        if info_type in ["summary", "consensus", "news"]:
            if not symbol:
                return "Error: symbol is required for this info type"
            params["symbol"] = symbol
        if info_type in ["news", "latest_news"]:
            params.update({"page": page, "limit": limit})
    
        url = f"{base}/{endpoint}"
        try:
            resp = requests.get(url, params=params, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting price target info {info_type} for {symbol}: {e}"
        return json.dumps(data)
  • server.py:1045-1058 (registration)
    The @fmp_server.tool decorator that registers the 'get_price_target_info' tool, specifying its name and description including parameter details.
    @fmp_server.tool(
        name="get_price_target_info",
        description="""获取分析师目标价相关信息,可选择汇总、共识或新闻。
    
    参数说明:
        info_type: str
            summary、consensus、news、latest_news
        symbol: str
            股票代码,news/summary/consensus 必填
        page: int
            页码,默认 0
        limit: int
            返回数量,默认 10""",
    )
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions pagination (page, limit parameters) which is useful, but doesn't describe response format, error conditions, rate limits, authentication requirements, or what happens when symbol is omitted for certain info_types. For a financial data tool with 4 parameters, 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.

Conciseness4/5

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

The description is efficiently structured with a clear purpose statement followed by parameter explanations. Every sentence adds value, though the Chinese/English mixing could be slightly cleaner. The information is front-loaded with the core purpose first.

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?

For a 4-parameter tool with no annotations and no output schema, the description provides adequate but incomplete context. It covers parameter meanings well but lacks information about return values, error handling, and behavioral constraints. Given the financial data context and sibling tools offering similar data, more guidance on tool selection would be beneficial.

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

Parameters4/5

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

With 0% schema description coverage, the description provides essential parameter semantics: it explains info_type options (summary, consensus, news, latest_news), indicates symbol is required for news/summary/consensus, and provides defaults for page and limit. This compensates well for the schema's lack of descriptions, though it doesn't fully explain all parameter interactions or constraints.

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 price target information) with specific info_type options (summary, consensus, news, latest_news). It distinguishes this from siblings like get_analyst_estimates or get_ratings by focusing specifically on price targets rather than broader analyst data. However, it doesn't explicitly contrast with these siblings.

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. While it mentions the info_type parameter options, it doesn't explain when to choose summary vs consensus vs news, or how this tool differs from other financial data tools in the sibling list. There's no mention of prerequisites, limitations, or comparison to similar tools.

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

Related 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/16Coffee/finance-mcp'

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