get_ticker_news
Retrieve recent news articles for a specific stock symbol, including title, content, and source details, to stay informed about market developments.
Instructions
Fetches recent news articles related to a specific stock symbol with title, content, and source details.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | The stock symbol |
Implementation Reference
- src/yfmcp/server.py:45-51 (handler)The main handler function for the 'get_ticker_news' tool, decorated with @mcp.tool() for registration in FastMCP. It takes a stock symbol, fetches the ticker using yfinance, retrieves news articles, and returns them as a string.@mcp.tool() def get_ticker_news(symbol: Annotated[str, Field(description="The stock symbol")]) -> str: """Fetches recent news articles related to a specific stock symbol with title, content, and source details.""" ticker = yf.Ticker(symbol) news = ticker.get_news() return str(news)
- src/yfmcp/server.py:45-45 (registration)The @mcp.tool() decorator registers the get_ticker_news function as an MCP tool.@mcp.tool()
- src/yfmcp/server.py:46-46 (schema)Input schema defined via Annotated[str, Field(...)] for the symbol parameter; output is str.def get_ticker_news(symbol: Annotated[str, Field(description="The stock symbol")]) -> str: