get_zz500_stocks
Retrieve CSI 500 Index constituent stocks for a specified date via the A-Share MCP Server, returning results in a markdown table format for clarity and analysis.
Instructions
Fetches the constituent stocks of the CSI 500 Index for a given date.
Args:
date: Optional. The date in 'YYYY-MM-DD' format. If None, uses the latest available date.
Returns:
Markdown table with CSI 500 constituent stocks or an error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No |
Implementation Reference
- src/tools/indices.py:90-107 (handler)Primary handler function for the 'get_zz500_stocks' MCP tool. Decorated with @app.tool() for automatic registration and schema inference. Implements tool logic by delegating data fetch to active_data_source and formatting output.@app.tool() def get_zz500_stocks(date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """ Fetch the constituent stocks of the CSI 500 Index for a given date. Args: date: Optional 'YYYY-MM-DD'. If None, uses the latest available date. Returns: Markdown table with CSI 500 constituent stocks or an error message. """ return call_index_constituent_tool( "get_zz500_stocks", active_data_source.get_zz500_stocks, "CSI 500", date, limit=limit, format=format )
- src/baostock_data_source.py:578-580 (helper)Core data retrieval helper in BaostockDataSource class. Fetches CSI 500 (ZZ500) constituent stocks from Baostock API via _fetch_index_constituent_data utility.def get_zz500_stocks(self, date: Optional[str] = None) -> pd.DataFrame: """Fetches CSI 500 index constituents using Baostock.""" return _fetch_index_constituent_data(bs.query_zz500_stocks, "CSI 500", date)
- mcp_server.py:53-53 (registration)Explicit registration of index tools (including get_zz500_stocks) by calling register_index_tools during MCP app initialization.register_index_tools(app, active_data_source)