Skip to main content
Glama
leoncuhk

MCP Yahoo Finance

by leoncuhk

get_stock_price_date_range

Retrieve historical stock prices for a specific symbol within a defined date range using Yahoo Finance data.

Instructions

Get the stock prices for a given date range for a given stock symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock symbol in Yahoo Finance format.
start_dateYesThe start date in YYYY-MM-DD format.
end_dateYesThe end date in YYYY-MM-DD format.

Implementation Reference

  • MCP tool handler for get_stock_price_date_range, decorated with @mcp_instance.tool() for registration. Delegates to YahooFinance instance method.
    @mcp_instance.tool()
    def get_stock_price_date_range(symbol: str, start_date: str, end_date: str) -> str:
        """Get the stock prices for a given date range for a given stock symbol.
    
        Args:
            symbol (str): Stock symbol in Yahoo Finance format.
            start_date (str): The start date in YYYY-MM-DD format.
            end_date (str): The end date in YYYY-MM-DD format.
        """
        return yf_instance.get_stock_price_date_range(symbol, start_date, end_date)
  • Core implementation in YahooFinance class: fetches historical stock prices using yfinance.Ticker.history() and returns Close prices as JSON.
    def get_stock_price_date_range(
        self, symbol: str, start_date: str, end_date: str
    ) -> str:
        """Get the stock prices for a given date range for a given stock symbol.
    
        Args:
            symbol (str): Stock symbol in Yahoo Finance format.
            start_date (str): The start date in YYYY-MM-DD format.
            end_date (str): The end date in YYYY-MM-DD format.
        """
        stock = Ticker(ticker=symbol, session=self.session)
        prices = stock.history(start=start_date, end=end_date)
        prices.index = prices.index.astype(str)
        return f"{prices['Close'].to_json(orient='index')}"
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't cover important aspects like whether it's a read-only operation, potential rate limits, error handling, data freshness, or the format of returned data (e.g., time series). This is inadequate 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.

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. Every part of the sentence contributes directly to understanding the tool's function, making it highly concise and well-structured.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., price data format, frequency), error conditions, or usage constraints. For a financial data tool with three parameters, this leaves significant gaps for an AI agent to operate effectively.

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%, with clear documentation for all three parameters (symbol format, date formats). The description adds minimal value beyond the schema, only implying that parameters are used together to fetch price data over a range. Baseline 3 is appropriate when the schema does the heavy lifting.

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 tool's purpose with a specific verb ('Get') and resource ('stock prices'), and specifies the scope ('for a given date range for a given stock symbol'). However, it doesn't explicitly differentiate from sibling tools like 'get_historical_stock_prices' or 'get_stock_price_by_date', which likely have overlapping functionality.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'get_current_stock_price' (for single-point data) or 'get_historical_stock_prices' (which might serve a similar purpose), leaving the agent without context for tool selection.

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

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/leoncuhk/mcp-yahoo-finance'

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