Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_stock_grades

Retrieve the latest analyst ratings for a specific stock using its ticker symbol, such as "AAPL", to inform investment decisions with expert insights.

Instructions

获取分析师最新评级。

参数说明: ticker: str 股票代码,例如 "AAPL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes

Implementation Reference

  • The main handler function for the get_stock_grades tool. It takes a stock ticker, fetches analyst grades from the Financial Modeling Prep API using the FMP_API_KEY, handles errors, and returns the data as JSON string.
    async def get_stock_grades(ticker: str) -> str:
        """获取指定股票的分析师最新评级"""
    
        api_key = os.environ.get("FMP_API_KEY")
        if not api_key:
            return "Error: FMP_API_KEY environment variable not set."
    
        url = "https://financialmodelingprep.com/stable/grades"
        try:
            resp = requests.get(url, params={"symbol": ticker, "apikey": api_key}, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting stock grades for {ticker}: {e}"
        return json.dumps(data)
  • server.py:726-733 (registration)
    The decorator that registers the get_stock_grades tool with the MCP server, including the tool name and input schema description.
    @fmp_server.tool(
        name="get_stock_grades",
        description="""获取分析师最新评级。
    
    参数说明:
        ticker: str
            股票代码,例如 "AAPL""",
    )
  • The description in the tool decorator defines the input schema: ticker (str, stock symbol like AAPL). Output is str (JSON).
        description="""获取分析师最新评级。
    
    参数说明:
        ticker: str
            股票代码,例如 "AAPL""",
    )
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. While '获取' (get) implies a read operation, the description doesn't mention important behavioral aspects like: whether this requires authentication, rate limits, what format the ratings come in, whether it's real-time or delayed data, or what happens if the ticker is invalid. For a tool with zero annotation coverage, this is insufficient behavioral context.

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 appropriately concise with two sentences: the purpose statement followed by parameter documentation. There's no wasted text, and the information is front-loaded with the main purpose first. The bilingual nature (Chinese purpose, Chinese parameter docs) is efficient for its target audience.

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

Completeness2/5

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

For a tool with no annotations, no output schema, and only 0% schema description coverage, the description is incomplete. It doesn't explain what the tool returns (ratings format, structure, possible values), doesn't mention error conditions, and doesn't provide enough behavioral context for safe usage. Given the complexity of financial data tools and the lack of structured documentation, more completeness is needed.

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 description provides parameter documentation in Chinese: 'ticker: str 股票代码,例如 "AAPL"' (ticker: str stock code, for example "AAPL"). With 0% schema description coverage, this adds meaningful semantic information about what the parameter represents and provides an example. However, it doesn't specify format constraints (e.g., exchange prefixes, case sensitivity) or validation rules beyond the basic example.

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 latest analyst ratings). It specifies the verb ('获取' - get) and resource ('分析师最新评级' - latest analyst ratings), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_ratings' or 'get_stock_grades_historical', which would be needed for a perfect score.

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 multiple sibling tools related to ratings/grades (get_ratings, get_stock_grades_historical, get_stock_grades_summary), there's no indication of what distinguishes this 'latest' ratings tool from those other options. The description simply states what it does without contextual usage information.

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