Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_stock_grade_latest_news

Retrieve recent stock rating updates from Yahoo Finance MCP Server. Customize results by page and limit to stay informed on market evaluations and analyst insights.

Instructions

获取最新评级新闻。

参数说明: page: int 页码,默认 0 limit: int 每页数量,最大 1000,默认 10

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
pageNo

Implementation Reference

  • The handler function that implements the tool logic. It fetches the latest stock grade news from the Financial Modeling Prep API endpoint 'grades-latest-news' using the provided page and limit parameters, handles API key, makes HTTP request, and returns JSON data or error.
    async def get_stock_grade_latest_news(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."
    
        url = "https://financialmodelingprep.com/stable/grades-latest-news"
        try:
            resp = requests.get(
                url,
                params={"page": page, "limit": limit, "apikey": api_key},
                timeout=10,
            )
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting latest grade news: {e}"
        return json.dumps(data)
  • server.py:845-854 (registration)
    The registration of the tool using the @fmp_server.tool decorator, specifying the name and description including parameter details.
    @fmp_server.tool(
        name="get_stock_grade_latest_news",
        description="""获取最新评级新闻。
    
    参数说明:
        page: int
            页码,默认 0
        limit: int
            每页数量,最大 1000,默认 10""",
    )
  • The function signature providing input schema via type hints (page: int default 0, limit: int default 10) and output as str (JSON).
    async def get_stock_grade_latest_news(page: int = 0, limit: int = 10) -> str:

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