Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_top_gainers

Retrieve a list of today's top-performing stocks from Yahoo Finance to identify significant market trends and opportunities.

Instructions

获取今日涨幅最大的股票列表。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that fetches the list of top gaining stocks from the Financial Modeling Prep API endpoint '/stock_market/gainers' and returns the data as a JSON string.
    async def get_top_gainers() -> 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/api/v3/stock_market/gainers"
        try:
            resp = requests.get(url, params={"apikey": api_key}, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting top gainers: {e}"
        return json.dumps(data)
  • server.py:684-687 (registration)
    Registers the 'get_top_gainers' tool with the FastMCP server instance 'fmp_server' using the @tool decorator, providing the tool name and Chinese description.
    @fmp_server.tool(
        name="get_top_gainers",
        description="""获取今日涨幅最大的股票列表。""",
    )

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