Skip to main content
Glama
24mlight

A Share MCP

get_zz500_stocks

Retrieve CSI 500 index constituents with date filtering and customizable output formats for A-share market analysis.

Instructions

CSI 500 constituents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo
limitNo
formatNomarkdown

Implementation Reference

  • The main handler function for the 'get_zz500_stocks' MCP tool. It is decorated with @app.tool() for registration and delegates execution to the use case layer via run_tool_with_handling.
    @app.tool() def get_zz500_stocks(date: Optional[str] = None, limit: int = 250, format: str = "markdown") -> str: """CSI 500 constituents.""" return run_tool_with_handling( lambda: fetch_index_constituents(active_data_source, index="zz500", date=date, limit=limit, format=format), context="get_zz500_stocks", )
  • Use case helper function that fetches ZZ500 stocks by mapping 'zz500' to data_source.get_zz500_stocks(), validates input, and formats the output as markdown table.
    def fetch_index_constituents(data_source: FinancialDataSource, *, index: str, date: Optional[str], limit: int, format: str) -> str: validate_output_format(format) key = validate_index_key(index, INDEX_MAP) if key == "hs300": df = data_source.get_hs300_stocks(date=date) elif key == "sz50": df = data_source.get_sz50_stocks(date=date) else: df = data_source.get_zz500_stocks(date=date) meta = {"index": key, "as_of": date or "latest"} return format_table_output(df, format=format, max_rows=limit, meta=meta)
  • Concrete implementation of get_zz500_stocks in BaostockDataSource, invoking the Baostock library's query_zz500_stocks via a shared helper.
    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)
  • Interface definition (schema) for the get_zz500_stocks method in FinancialDataSource abstract base class.
    @abstractmethod def get_zz500_stocks(self, date: Optional[str] = None) -> pd.DataFrame: pass

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