Skip to main content
Glama
24mlight

A-Share MCP Server

get_trade_dates

Retrieve trading dates for China's A-share market within a specified date range, returning results as a table showing trading and non-trading days.

Instructions

    Fetch trading dates within a specified range.

    Args:
        start_date: Optional. Start date in 'YYYY-MM-DD' format. Defaults to 2015-01-01 if None.
        end_date: Optional. End date in 'YYYY-MM-DD' format. Defaults to the current date if None.

    Returns:
        Markdown table with 'is_trading_day' (1=trading, 0=non-trading).
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateNo
end_dateNo
limitNo
formatNomarkdown

Implementation Reference

  • The primary handler for the 'get_trade_dates' MCP tool. It defines the input schema via type hints and docstring, registers the tool via @app.tool(), logs usage, and delegates execution to the fetch_trade_dates helper wrapped in error handling.
    @app.tool()
    def get_trade_dates(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str:
        """
        Fetch trading dates within a specified range.
    
        Args:
            start_date: Optional. Start date in 'YYYY-MM-DD' format. Defaults to 2015-01-01 if None.
            end_date: Optional. End date in 'YYYY-MM-DD' format. Defaults to the current date if None.
    
        Returns:
            Markdown table with 'is_trading_day' (1=trading, 0=non-trading).
        """
        logger.info(f"Tool 'get_trade_dates' called for range {start_date or 'default'} to {end_date or 'default'}")
        return run_tool_with_handling(
            lambda: fetch_trade_dates(active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format),
            context="get_trade_dates",
        )
  • mcp_server.py:54-54 (registration)
    Top-level registration call that invokes the registration of market overview tools, including 'get_trade_dates', passing the FastMCP app instance and active data source.
    register_market_overview_tools(app, active_data_source)
  • Core helper function that fetches trade dates from the data source interface, applies output format validation, and formats the result as a table.
    def fetch_trade_dates(data_source: FinancialDataSource, *, start_date: Optional[str], end_date: Optional[str], limit: int, format: str) -> str:
        validate_output_format(format)
        df = data_source.get_trade_dates(start_date=start_date, end_date=end_date)
        meta = {"start_date": start_date or "default", "end_date": end_date or "default"}
        return format_table_output(df, format=format, max_rows=limit, meta=meta)
  • Input/output schema defined by function signature type hints and detailed docstring describing parameters and return value.
    def get_trade_dates(start_date: Optional[str] = None, end_date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str:
        """
        Fetch trading dates within a specified range.
    
        Args:
            start_date: Optional. Start date in 'YYYY-MM-DD' format. Defaults to 2015-01-01 if None.
            end_date: Optional. End date in 'YYYY-MM-DD' format. Defaults to the current date if None.
    
        Returns:
            Markdown table with 'is_trading_day' (1=trading, 0=non-trading).
        """
        logger.info(f"Tool 'get_trade_dates' called for range {start_date or 'default'} to {end_date or 'default'}")
        return run_tool_with_handling(
            lambda: fetch_trade_dates(active_data_source, start_date=start_date, end_date=end_date, limit=limit, format=format),
            context="get_trade_dates",
        )
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the return format (Markdown table) and the meaning of 'is_trading_day' values, which is helpful. However, it lacks details on rate limits, error handling, or data source constraints, leaving behavioral gaps for a tool with no annotation coverage.

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 well-structured with a purpose statement, Args section, and Returns section, all in three sentences. It is front-loaded and wastes no words, making it easy to parse quickly.

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 4 parameters with 0% schema coverage, the description is incomplete. It covers the core purpose and two parameters but misses 'limit' and 'format', and lacks behavioral details like pagination or error handling. It's adequate for basic use but has clear gaps.

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 explains 'start_date' and 'end_date' with formats and defaults, adding value beyond the schema. However, it omits 'limit' and 'format' parameters entirely, leaving them undocumented. The description partially compensates but not fully for all parameters.

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 tool's purpose with a specific verb ('Fetch') and resource ('trading dates within a specified range'), distinguishing it from siblings like 'is_trading_day' (checks a single date) and 'get_last_n_trading_days' (count-based). It precisely defines what the tool does.

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 provides clear context for when to use this tool (to fetch trading dates in a date range) but does not explicitly mention when not to use it or name alternatives like 'get_last_n_trading_days' or 'is_trading_day'. The context is sufficient for basic selection.

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/24mlight/a-share-mcp-is-just-i-need'

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