Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_stock_grade_news

Retrieve stock rating news for a specific ticker using customizable pagination. Access detailed financial insights directly from Yahoo Finance. Ideal for tracking market analyst updates efficiently.

Instructions

获取指定股票的评级新闻。

参数说明: ticker: str 股票代码,例如 "AAPL" page: int 页码,默认 0 limit: int 每页数量,最大 100,默认 1

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
pageNo
tickerYes

Implementation Reference

  • The main handler function that executes the tool logic: fetches analyst grade news for a given stock ticker from the FMP API endpoint /stable/grades-news, handles API key, pagination, and returns JSON data.
    async def get_stock_grade_news(ticker: str, page: int = 0, limit: int = 1) -> 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-news"
        try:
            resp = requests.get(
                url,
                params={
                    "symbol": ticker,
                    "page": page,
                    "limit": limit,
                    "apikey": api_key,
                },
                timeout=10,
            )
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting grade news for {ticker}: {e}"
        return json.dumps(data)
  • server.py:807-818 (registration)
    Tool registration using the FastMCP decorator, specifying the tool name and description with input parameters (serving as schema).
    @fmp_server.tool(
        name="get_stock_grade_news",
        description="""获取指定股票的评级新闻。
    
    参数说明:
        ticker: str
            股票代码,例如 "AAPL"
        page: int
            页码,默认 0
        limit: int
            每页数量,最大 100,默认 1""",
    )
  • Description string defining the input schema: ticker (str), page (int, default 0), limit (int, default 1).
        description="""获取指定股票的评级新闻。
    
    参数说明:
        ticker: str
            股票代码,例如 "AAPL"
        page: int
            页码,默认 0
        limit: int
            每页数量,最大 100,默认 1""",
    )
  • Tool mentioned in the server instructions list.
    - get_stock_grade_news:获取指定股票的评级新闻。

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