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", )

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