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 range. Returns a markdown table indicating trading days (1) and non-trading days (0), aiding in market analysis and planning.

Instructions

Fetches trading dates information 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 indicating whether each date in the range was a trading day (1) or not (0).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateNo
start_dateNo

Implementation Reference

  • The handler function for the 'get_trade_dates' MCP tool. It uses the active data source to fetch trade dates and formats the output as markdown or other formats.
    @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'}") try: # Add date validation if desired df = active_data_source.get_trade_dates( start_date=start_date, end_date=end_date) logger.info("Successfully retrieved trade dates.") 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) except NoDataFoundError as e: logger.warning(f"NoDataFoundError: {e}") return f"Error: {e}" except LoginError as e: logger.error(f"LoginError: {e}") return f"Error: Could not connect to data source. {e}" except DataSourceError as e: logger.error(f"DataSourceError: {e}") return f"Error: An error occurred while fetching data. {e}" except ValueError as e: logger.warning(f"ValueError: {e}") return f"Error: Invalid input parameter. {e}" except Exception as e: logger.exception( f"Unexpected Exception processing get_trade_dates: {e}") return f"Error: An unexpected error occurred: {e}"
  • mcp_server.py:54-54 (registration)
    The registration call for market overview tools, which includes the get_trade_dates tool, in the main MCP server setup.
    register_market_overview_tools(app, active_data_source)
  • The registration function that defines and registers the get_trade_dates tool using @app.tool() decorator.
    def register_market_overview_tools(app: FastMCP, active_data_source: FinancialDataSource): """ Register market overview tools with the MCP app. Args: app: The FastMCP app instance active_data_source: The active financial data source """

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