Skip to main content
Glama
leoncuhk

MCP Yahoo Finance

by leoncuhk

get_current_stock_price

Retrieve real-time stock price data for any publicly traded company using its stock symbol. This tool provides current market prices to support investment decisions and financial analysis.

Instructions

Get the current stock price based on stock symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock symbol in Yahoo Finance format.

Implementation Reference

  • The primary MCP tool handler for 'get_current_stock_price', registered via @mcp_instance.tool() decorator. It delegates execution to the YahooFinance instance's method.
    @mcp_instance.tool()
    def get_current_stock_price(symbol: str) -> str:
        """Get the current stock price based on stock symbol.
    
        Args:
            symbol (str): Stock symbol in Yahoo Finance format.
        """
        return yf_instance.get_current_stock_price(symbol)
  • Supporting helper method in the YahooFinance class that performs the actual API call to yfinance to retrieve the current stock price.
    def get_current_stock_price(self, symbol: str) -> str:
        """Get the current stock price based on stock symbol.
    
        Args:
            symbol (str): Stock symbol in Yahoo Finance format.
        """
        stock = Ticker(ticker=symbol, session=self.session).info
        current_price = stock.get(
            "regularMarketPrice", stock.get("currentPrice", "N/A")
        )
        return (
            f"{current_price:.4f}"
            if current_price
            else f"Couldn't fetch {symbol} current price"
        )
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. While 'Get' implies a read operation, it doesn't specify whether this requires authentication, has rate limits, returns real-time or delayed data, or what format the price is in (e.g., currency, decimals). For a financial data tool with zero annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

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 that efficiently conveys the core functionality without any wasted words. It's appropriately sized for a simple tool and front-loads the essential information, making it easy to parse quickly.

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 the lack of annotations and output schema, the description is incomplete for a tool that likely returns financial data. It doesn't explain what the output includes (e.g., price alone, with timestamp, currency), potential errors (e.g., invalid symbol), or behavioral aspects like data freshness. For a stock price tool with no structured output documentation, more context is needed to fully understand its operation.

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?

The description mentions 'based on stock symbol', which aligns with the single parameter 'symbol' in the input schema. Since schema description coverage is 100% (the schema already describes 'symbol' as 'Stock symbol in Yahoo Finance format'), the description adds minimal value beyond what's in the structured data. This meets the baseline of 3 for high schema coverage without additional param details.

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 verb 'Get' and the resource 'current stock price', making the purpose immediately understandable. It specifies 'based on stock symbol' which adds useful context. However, it doesn't explicitly differentiate from sibling tools like 'get_stock_price_by_date' or 'get_stock_price_date_range', which would require more specific language about the 'current' aspect.

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. With multiple sibling tools for stock price data (e.g., 'get_stock_price_by_date', 'get_stock_price_date_range', 'get_historical_stock_prices'), there's no indication of when this specific tool for 'current' prices is appropriate versus those for historical or date-specific queries. No exclusions or prerequisites are mentioned.

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