Skip to main content
Glama
xinkuang

China Stock MCP

by xinkuang

get_stock_circulate_stock_holder

Retrieve circulating shareholder data for Chinese stocks to analyze ownership distribution and identify major investors in publicly traded companies.

Instructions

获取指定股票的流通股东情况

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes股票代码 (例如: '000001')
output_formatNo输出数据格式: json, csv, xml, excel, markdown, html。默认: markdownmarkdown

Implementation Reference

  • MCP tool registration decorator for the get_stock_circulate_stock_holder tool.
    @mcp.tool(
        name="get_stock_circulate_stock_holder", description="获取指定股票的流通股东情况"
    )
  • The handler function implementing the tool logic: fetches stock circulate holder data with fallback to main stock holder using akshare, handles empty data, and formats output in specified format.
    def get_stock_circulate_stock_holder(
        symbol: Annotated[str, Field(description="股票代码 (例如: '000001')")],
        output_format: Annotated[
            Literal["json", "csv", "xml", "excel", "markdown", "html"],
            Field(description="输出数据格式: json, csv, xml, excel, markdown, html。默认: markdown"),
        ] = "markdown"
    ) -> str:
        """获取指定股票的流通股东情况,支持降级使用 stock_main_stock_holder."""
    
        def _circulate_stock_holder_fetcher(source: str, **kwargs: Any) -> pd.DataFrame:
            if source == "akshare":
                return ak.stock_circulate_stock_holder(**kwargs)
            elif source == "main_stock_holder":
                return ak.stock_main_stock_holder(**kwargs)
            else:
                raise ValueError(f"不支持的数据源: {source}")
    
        df = _fetch_data_with_fallback(
            fetch_func=_circulate_stock_holder_fetcher,
            primary_source="akshare",
            fallback_sources=["main_stock_holder"],
            symbol=symbol,
        )
        if df.empty:
            df = pd.DataFrame()
        return _format_dataframe_output(df, output_format)
  • Input schema defined via Pydantic Annotated types for symbol (str) and output_format (Literal).
        symbol: Annotated[str, Field(description="股票代码 (例如: '000001')")],
        output_format: Annotated[
            Literal["json", "csv", "xml", "excel", "markdown", "html"],
            Field(description="输出数据格式: json, csv, xml, excel, markdown, html。默认: markdown"),
        ] = "markdown"
    ) -> str:
  • Inner helper function to fetch data from different sources (akshare or main_stock_holder).
    def _circulate_stock_holder_fetcher(source: str, **kwargs: Any) -> pd.DataFrame:
        if source == "akshare":
            return ak.stock_circulate_stock_holder(**kwargs)
        elif source == "main_stock_holder":
            return ak.stock_main_stock_holder(**kwargs)
        else:
            raise ValueError(f"不支持的数据源: {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/xinkuang/china-stock-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server