Skip to main content
Glama
narumiruna

Yahoo Finance MCP Server

search

Retrieve stock quotes and news articles from Yahoo Finance using ticker symbols or company names. Filter search results by type for tailored financial insights.

Instructions

Fetches and organizes search results from Yahoo Finance, including stock quotes and news articles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query (ticker symbol or company name)
search_typeYesType of search results to retrieve

Implementation Reference

  • The handler function for the 'search' tool, decorated with @mcp.tool() for registration. It takes a query and search_type, performs a Yahoo Finance search using yf.Search, and returns JSON based on the search_type (all, quotes, or news).
    @mcp.tool() def search( query: Annotated[str, Field(description="The search query (ticker symbol or company name)")], search_type: Annotated[SearchType, Field(description="Type of search results to retrieve")], ) -> str: """Fetches and organizes search results from Yahoo Finance, including stock quotes and news articles.""" s = yf.Search(query) match search_type.lower(): case "all": return json.dumps(s.all, ensure_ascii=False) case "quotes": return json.dumps(s.quotes, ensure_ascii=False) case "news": return json.dumps(s.news, ensure_ascii=False) case _: return "Invalid output_type. Use 'all', 'quotes', or 'news'."
  • Pydantic-compatible type definition (Literal) for the search_type parameter of the search tool, defining allowed values: 'all', 'quotes', 'news'.
    SearchType = Literal[ "all", "quotes", "news", ]

Other Tools

Related Tools

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/narumiruna/yfinance-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server