Skip to main content
Glama
xinkuang

China Stock MCP

by xinkuang

get_shareholder_info

Retrieve shareholder information for specific Chinese stocks to analyze ownership structure and investor composition using stock symbol lookup.

Instructions

获取指定股票的股东情况

Input Schema

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

Implementation Reference

  • Registers the get_shareholder_info tool with the MCP framework, specifying its name and description.
    @mcp.tool(name="get_shareholder_info", description="获取指定股票的股东情况")
  • Main handler function for the get_shareholder_info tool. Takes stock symbol and output format, fetches shareholder data using akshare, handles empty data, and formats output.
    def get_shareholder_info(
        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:
        """获取股东情况"""
        def get_shareholder_info_fetcher(
            symbol: str, **kwargs: Any
        ) -> pd.DataFrame:
            """获取股东数据"""
            return ak.stock_zh_a_gdhs_detail_em(symbol)
        
        df = get_shareholder_info_fetcher(symbol)    
        if df.empty:
            df = pd.DataFrame()
        return _format_dataframe_output(df, output_format)
  • Pydantic schema definitions for input parameters: symbol (str) and output_format (Literal with default 'markdown'), output is str.
    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"
  • Helper function to fetch shareholder detail data from akshare (stock_zh_a_gdhs_detail_em).
    def get_shareholder_info_fetcher(
        symbol: str, **kwargs: Any
    ) -> pd.DataFrame:
        """获取股东数据"""
        return ak.stock_zh_a_gdhs_detail_em(symbol)

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