get_top_losers
Identify stocks with the largest daily price declines using the Yahoo Finance MCP Server's tool for tracking top market losers.
Instructions
获取今日跌幅最大的股票列表。
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_top_losers"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:709-723 (handler)The handler function that implements the logic for the 'get_top_losers' tool. It fetches the daily top losers from the Financial Modeling Prep API using the provided API key and returns the JSON data as a string.
async def get_top_losers() -> 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/losers" 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 losers: {e}" return json.dumps(data) - server.py:705-708 (registration)The registration of the 'get_top_losers' tool using the FastMCP decorator, specifying the tool name and description.
@fmp_server.tool( name="get_top_losers", description="""获取今日跌幅最大的股票列表。""", )