Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_stock_actions

Retrieve historical stock dividend and split data by providing a stock ticker. This tool extracts detailed corporate action records from Yahoo Finance for informed investment analysis.

Instructions

获取股票的分红与拆股历史。

参数说明: ticker: str 股票代码,例如 "AAPL"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes

Implementation Reference

  • server.py:190-198 (registration)
    Tool registration using @fmp_server.tool decorator, specifying name and description with input schema implied.
    @fmp_server.tool(
        name="get_stock_actions",
        description="""获取股票的分红与拆股历史。
    
    参数说明:
        ticker: str
            股票代码,例如 "AAPL"
    """,
    )
  • The core handler function that retrieves historical stock dividends and splits from the Financial Modeling Prep API using requests and pandas, returning JSON data.
    async def get_stock_actions(ticker: str) -> str:
        """Get stock dividends and stock splits for a given ticker symbol"""
        api_key = os.environ.get("FMP_API_KEY")
        if not api_key:
            return "Error: FMP_API_KEY environment variable not set."
    
        base = "https://financialmodelingprep.com/api/v3"
        try:
            div_resp = requests.get(
                f"{base}/historical-price-full/stock_dividend/{ticker}",
                params={"apikey": api_key},
                timeout=10,
            )
            div_resp.raise_for_status()
            div_df = pd.DataFrame(div_resp.json().get("historical", []))
            split_resp = requests.get(
                f"{base}/historical-price-full/stock_split/{ticker}",
                params={"apikey": api_key},
                timeout=10,
            )
            split_resp.raise_for_status()
            split_df = pd.DataFrame(split_resp.json().get("historical", []))
        except Exception as e:
            return f"Error: getting stock actions for {ticker}: {e}"
    
        return json.dumps(
            {
                "dividends": div_df.to_dict("records"),
                "splits": split_df.to_dict("records"),
            }
        )
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 retrieves historical data, implying it's a read-only operation, but doesn't disclose behavioral traits such as rate limits, authentication needs, data freshness, error handling, or output format (e.g., JSON structure, date ranges). For a data retrieval tool with zero annotation coverage, this is a significant gap.

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

Conciseness3/5

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

The description is appropriately sized with two sentences, but the structure is not fully front-loaded. The first sentence states the purpose clearly, but the second sentence is a parameter explanation that might be better integrated or omitted if schema coverage were higher. It's concise but could be more streamlined for an agent's quick parsing.

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 tool's complexity (historical data retrieval), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain what the output includes (e.g., dividend amounts, split ratios, dates), how far back history goes, or any limitations. For a tool with one parameter but rich expected output, more context is needed.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It adds meaningful semantics for the single parameter 'ticker' by explaining it's a stock code with an example ('AAPL'), which clarifies format and intent beyond the schema's basic string type. However, it doesn't cover constraints like valid ticker formats or error cases, preventing a score of 5.

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 as '获取股票的分红与拆股历史' (Get stock dividend and split history), which is a specific verb+resource combination. It distinguishes from siblings like get_historical_stock_prices (price data) or get_financial_statement (financial reports), but doesn't explicitly differentiate from tools like get_stock_grades_historical (historical grades) or get_stock_info (general info), keeping it at 4 rather than 5.

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 (e.g., requires a valid ticker), exclusions (e.g., not for crypto or indices), or compare to siblings like get_stock_info (which might include some action data). Usage is implied only by the tool name and description.

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/16Coffee/finance-mcp'

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