Skip to main content
Glama

get_cni_index_detail

Retrieve constituent stock details for specific Chinese stock market indices by providing index code and date to analyze index composition and holdings.

Instructions

获取指定指数的成分股样本详情

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes指数代码 (例如: '399001')
dateYes日期,格式为 YYYYMM (例如: '202404')
output_formatNo输出数据格式: json, csv, xml, excel, markdown, html。默认: markdownmarkdown

Implementation Reference

  • The handler function implementing the tool logic: fetches index constituent details using akshare.index_detail_cni for the given symbol and date, handles empty data, and formats output as specified.
    def get_cni_index_detail( symbol: Annotated[str, Field(description="指数代码 (例如: '399001')")], date: Annotated[str, Field(description="日期,格式为 YYYYMM (例如: '202404')")], output_format: Annotated[ Literal["json", "csv", "xml", "excel", "markdown", "html"], Field(description="输出数据格式: json, csv, xml, excel, markdown, html。默认: markdown"), ] = "markdown" ) -> str: """获取指定指数的成分股样本详情.""" df = ak.index_detail_cni(symbol=symbol, date=date) if df.empty: df = pd.DataFrame() return _format_dataframe_output(df, output_format)
  • Registers the tool using FastMCP's @mcp.tool decorator with the tool name and description.
    @mcp.tool( name="get_cni_index_detail", description="获取指定指数的成分股样本详情" )
  • Pydantic schema definitions for tool inputs using Annotated and Field for validation and descriptions.
    symbol: Annotated[str, Field(description="指数代码 (例如: '399001')")], date: Annotated[str, Field(description="日期,格式为 YYYYMM (例如: '202404')")], output_format: Annotated[ Literal["json", "csv", "xml", "excel", "markdown", "html"], Field(description="输出数据格式: json, csv, xml, excel, markdown, html。默认: markdown"), ] = "markdown" ) -> str:

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