Skip to main content
Glama
24mlight

A Share MCP

list_industries

Retrieve distinct industry classifications for A-share stocks on a specified date to analyze market sectors and industry composition.

Instructions

List distinct industries for a given date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo
formatNomarkdown

Implementation Reference

  • The main handler function for the 'list_industries' tool. It is decorated with @app.tool() which registers it with the MCP server, logs the call, and executes the core logic via run_tool_with_handling delegating to fetch_list_industries.
    @app.tool()
    def list_industries(date: Optional[str] = None, format: str = "markdown") -> str:
        """List distinct industries for a given date."""
        logger.info("Tool 'list_industries' called date=%s", date or "latest")
        return run_tool_with_handling(
            lambda: fetch_list_industries(active_data_source, date=date, format=format),
            context="list_industries",
        )
  • Helper function containing the core business logic: fetches stock industry data, extracts unique sorted industries, and formats as markdown table.
    def fetch_list_industries(data_source: FinancialDataSource, *, date: Optional[str], format: str) -> str:
        validate_output_format(format)
        df = data_source.get_stock_industry(code=None, date=date)
        if df is None or df.empty:
            return "(No data available to display)"
        col = "industry" if "industry" in df.columns else df.columns[-1]
        out = df[[col]].drop_duplicates().sort_values(by=col)
        out = out.rename(columns={col: "industry"})
        meta = {"as_of": date or "latest", "count": int(out.shape[0])}
        return format_table_output(out, format=format, max_rows=out.shape[0], meta=meta)
  • mcp_server.py:53-53 (registration)
    Invocation of register_index_tools during server startup, which triggers the registration of the list_industries tool.
    register_index_tools(app, active_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