Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_calendar_data

Retrieve calendar data for financial events like dividends, earnings, IPOs, and stock splits using event types, stock symbols, and pagination parameters.

Instructions

获取分红、收益、IPO、拆股等日历信息。

参数说明: event_type: str 可选值:dividends、dividends_calendar、earnings、earnings_calendar、 ipos_calendar、ipos_disclosure、ipos_prospectus、splits、splits_calendar symbol: str 部分类型需要股票代码 page: int 页码,默认 0 limit: int 返回数量,默认 100

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
event_typeYes
limitNo
pageNo
symbolNo

Implementation Reference

  • The async handler function that implements the get_calendar_data tool logic. It fetches various calendar events (dividends, earnings, IPOs, splits) from the Financial Modeling Prep API based on the event_type, optional symbol, page, and limit parameters.
    async def get_calendar_data(
        event_type: str,
        symbol: str = "",
        page: int = 0,
        limit: int = 100,
    ) -> str:
        """根据事件类型获取相关日历数据"""
    
        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/stable"
        endpoint_map = {
            "dividends": "dividends",
            "dividends_calendar": "dividends-calendar",
            "earnings": "earnings",
            "earnings_calendar": "earnings-calendar",
            "ipos_calendar": "ipos-calendar",
            "ipos_disclosure": "ipos-disclosure",
            "ipos_prospectus": "ipos-prospectus",
            "splits": "splits",
            "splits_calendar": "splits-calendar",
        }
        endpoint = endpoint_map.get(event_type.lower())
        if not endpoint:
            return "Error: invalid event type"
    
        params = {"apikey": api_key}
        if event_type in ["dividends", "earnings", "splits"] and not symbol:
            return "Error: symbol is required for this event type"
        if symbol:
            params["symbol"] = symbol
        if event_type in ["ipos_calendar", "ipos_disclosure", "ipos_prospectus"]:
            params.update({"page": page, "limit": limit})
    
        url = f"{base}/{endpoint}"
        try:
            resp = requests.get(url, params=params, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting calendar data {event_type}: {e}"
        return json.dumps(data)
  • server.py:281-295 (registration)
    The @fmp_server.tool decorator that registers the get_calendar_data tool, specifying its name, description, and input parameters schema.
    @fmp_server.tool(
        name="get_calendar_data",
        description="""获取分红、收益、IPO、拆股等日历信息。
    
    参数说明:
        event_type: str
            可选值:dividends、dividends_calendar、earnings、earnings_calendar、
            ipos_calendar、ipos_disclosure、ipos_prospectus、splits、splits_calendar
        symbol: str
            部分类型需要股票代码
        page: int
            页码,默认 0
        limit: int
            返回数量,默认 100""",
    )
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions pagination (page, limit) and that some event types require a symbol, but lacks critical behavioral details: whether this is a read-only operation, rate limits, authentication needs, error handling, or what the output format looks like. The description is minimal and doesn't compensate for the lack of annotations.

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 front-loaded with the purpose, followed by parameter details. It's relatively concise but could be more structured; the parameter explanations are listed without clear headings or separation, and some sentences are redundant (e.g., repeating '部分类型需要股票代码' could be integrated better). Overall, it's adequate but not optimally organized.

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 (4 parameters, no annotations, no output schema), the description is incomplete. It covers parameters well but misses behavioral context, output details, and usage guidelines. For a tool fetching financial calendar data, this leaves gaps in understanding how to interpret results or handle errors, making it insufficient for full agent comprehension.

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 significant value by explaining each parameter: event_type with its enum-like options, symbol as optional for some types, and page/limit with defaults. This goes beyond the bare schema, though it doesn't detail format constraints (e.g., symbol format) or interdependencies (e.g., which event_types require symbol).

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: '获取分红、收益、IPO、拆股等日历信息' (Get calendar information for dividends, earnings, IPOs, splits, etc.). It specifies the resource (calendar data) and types of events, though it doesn't explicitly differentiate from sibling tools like get_economic_data or get_stock_actions, which might have overlapping financial data domains.

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?

No guidance is provided on when to use this tool versus alternatives. The description lists event types but doesn't explain context, prerequisites, or exclusions. For example, it doesn't clarify if this is for historical or future events, or how it differs from tools like get_stock_actions that might handle similar data.

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