get_news
Retrieve relevant news articles for a specific stock symbol using the MCP Yahoo Finance server. Stay informed with financial updates directly tied to your investment interests.
Instructions
Get news for a given stock symbol.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock symbol in Yahoo Finance format. |
Implementation Reference
- src/mcp_yahoo_finance/server.py:296-303 (handler)MCP tool handler for 'get_news', registered via @mcp_instance.tool() decorator. Delegates to the YahooFinance instance's get_news method.@mcp_instance.tool() def get_news(symbol: str) -> str: """Get news for a given stock symbol. Args: symbol (str): Stock symbol in Yahoo Finance format. """ return yf_instance.get_news(symbol)
- Core helper function in YahooFinance class that fetches news headlines for a stock symbol using yfinance.Ticker and returns JSON dump.def get_news(self, symbol: str) -> str: """Get news for a given stock symbol. Args: symbol (str): Stock symbol in Yahoo Finance format. """ stock = Ticker(ticker=symbol, session=self.session) return json.dumps(stock.news, indent=2)