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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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",
    ]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only states what the tool does ('fetches and organizes'), not behavioral traits like rate limits, authentication needs, or response format. It mentions 'search results' but doesn't detail what 'organizes' entails, leaving gaps in transparency for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads key information (action and resource). It avoids redundancy but could be slightly more structured by separating purpose from included data types for better clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, 2 parameters with full schema coverage, and an output schema (which handles return values), the description is adequate but incomplete. It covers the basic purpose but lacks behavioral context (e.g., how results are organized, any limitations), making it minimally viable but with clear gaps in transparency.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters (query and search_type with enum). The description adds minimal value by implying the query can be a 'ticker symbol or company name' and results include 'stock quotes and news articles', but this mostly aligns with schema details, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('fetches and organizes') and resource ('search results from Yahoo Finance'), specifying it includes 'stock quotes and news articles'. However, it doesn't explicitly differentiate from sibling tools like get_ticker_news or get_ticker_info, which handle similar data types, making it clear but not sibling-distinctive.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like get_ticker_news or get_ticker_info. The description implies a general search function but lacks explicit when/when-not instructions or prerequisites, leaving usage context vague.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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