Skip to main content
Glama
maxscheijen

MCP Yahoo Finance

by maxscheijen

get_news

Fetch news articles for any stock symbol using Yahoo Finance data. Retrieve relevant updates to stay informed on market trends and company developments.

Instructions

Get news for a given stock symbol.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock symbol in Yahoo Finance format.

Implementation Reference

  • The core handler function that fetches the latest news for a given stock symbol using yfinance's Ticker.news property and serializes it to JSON.
    def get_news(self, symbol: str) -> str:
        """Get news for a given stock symbol.
    
        Args:
            symbol (str): Stock symbol in Yahoo Finance format.
        """
        stock = Ticker(ticker=symbol, session=self.session)
        return json.dumps(stock.news, indent=2)
  • Registers the 'get_news' tool in the MCP server's list_tools() by wrapping the handler function with generate_tool, which also generates the input schema from the function signature and docstring.
    generate_tool(yf.get_news),
  • Dispatches execution of the 'get_news' tool call to the underlying YahooFinance.get_news handler and formats the result as MCP TextContent.
    case "get_news":
        price = yf.get_news(**args)
        return [TextContent(type="text", text=price)]
  • Helper function used to generate the Tool schema (including input schema) for get_news and other tools from Python function introspection and docstring parsing.
    def generate_tool(func: Any) -> Tool:
        """Generates a tool schema from a Python function."""
        signature = inspect.signature(func)
        docstring = inspect.getdoc(func) or ""
        param_descriptions = parse_docstring(docstring)
    
        schema = {
            "name": func.__name__,
            "description": docstring.split("Args:")[0].strip(),
            "inputSchema": {
                "type": "object",
                "properties": {},
            },
        }
    
        for param_name, param in signature.parameters.items():
            param_type = (
                "number"
                if param.annotation is float
                else "string"
                if param.annotation is str
                else "string"
            )
            schema["inputSchema"]["properties"][param_name] = {
                "type": param_type,
                "description": param_descriptions.get(param_name, ""),
            }
    
            if "required" not in schema["inputSchema"]:
                schema["inputSchema"]["required"] = [param_name]
            else:
                if "=" not in str(param):
                    schema["inputSchema"]["required"].append(param_name)
    
        return Tool(**schema)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Get news') but doesn't describe behavioral traits such as data sources, rate limits, authentication needs, or what 'news' entails (e.g., recent articles, headlines). This leaves significant gaps in understanding how the tool behaves beyond its basic function.

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 extremely concise and front-loaded, consisting of a single sentence that directly states the tool's purpose. There is no wasted language or unnecessary elaboration, making it efficient and easy to parse for an AI agent.

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 complexity of fetching news data, the lack of annotations, and no output schema, the description is incomplete. It doesn't explain what 'news' includes (e.g., format, recency, sources) or behavioral aspects like error handling. For a tool with no structured support, this description leaves too many unanswered questions for effective use.

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 adds minimal meaning beyond the input schema, which has 100% coverage and clearly documents the 'symbol' parameter. The description implies the parameter is used to fetch news but doesn't provide additional context like format examples or constraints. Since the schema does the heavy lifting, a baseline score of 3 is appropriate.

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 ('news for a given stock symbol'), making it immediately understandable. However, it doesn't explicitly differentiate from siblings like 'get_recommendations' or 'get_earning_dates', which might also provide news-related information, so it falls short of a perfect score.

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 prerequisites, context for use, or compare it to sibling tools like 'get_recommendations' or 'get_earning_dates', which could overlap in functionality. This lack of usage context leaves the agent without clear direction.

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

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