Skip to main content
Glama
leoncuhk

MCP Yahoo Finance

by leoncuhk

get_stock_price_by_date

Retrieve historical stock prices for specific symbols and dates to analyze market trends and track investment performance.

Instructions

Get the stock price for a given stock symbol on a specific date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock symbol in Yahoo Finance format.
dateYesThe date in YYYY-MM-DD format.

Implementation Reference

  • MCP tool handler for 'get_stock_price_by_date'. Decorated with @mcp_instance.tool(), defines input schema via annotations and docstring, and delegates execution to the YahooFinance instance method.
    @mcp_instance.tool()
    def get_stock_price_by_date(symbol: str, date: str) -> str:
        """Get the stock price for a given stock symbol on a specific date.
    
        Args:
            symbol (str): Stock symbol in Yahoo Finance format.
            date (str): The date in YYYY-MM-DD format.
        """
        return yf_instance.get_stock_price_by_date(symbol, date)
  • YahooFinance class helper method that implements the core logic: fetches historical stock data for a specific date using yfinance Ticker.history() and returns the closing price.
    def get_stock_price_by_date(self, symbol: str, date: str) -> str:
        """Get the stock price for a given stock symbol on a specific date.
    
        Args:
            symbol (str): Stock symbol in Yahoo Finance format.
            date (str): The date in YYYY-MM-DD format.
        """
        stock = Ticker(ticker=symbol, session=self.session)
        price = stock.history(start=date, period="1d")
        return f"{price.iloc[0]['Close']:.4f}"
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. It states the tool's function but lacks behavioral details such as data source (implied Yahoo Finance from schema), potential rate limits, error handling, or return format (e.g., price value, currency).

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, clear sentence with zero waste, front-loaded with the core purpose, and appropriately sized for the tool's complexity.

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, no output schema, and 100% schema coverage, the description is adequate but incomplete. It covers the purpose but lacks details on behavior, output, or usage context, leaving gaps for an AI agent.

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 (symbol and date) with formats. The description adds no additional parameter semantics beyond what the schema provides, meeting the baseline of 3.

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

Purpose5/5

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

The description clearly states the verb 'Get' and the resource 'stock price', specifies the target 'for a given stock symbol on a specific date', and distinguishes it from siblings like get_current_stock_price (current vs. specific date) and get_stock_price_date_range (single date vs. range).

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

Usage Guidelines4/5

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

The description implies usage for retrieving historical stock prices at a specific date, but does not explicitly state when to use this tool versus alternatives like get_current_stock_price or get_stock_price_date_range, nor does it mention exclusions or prerequisites.

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