Skip to main content
Glama
24mlight

A Share MCP

get_dupont_data

Retrieve quarterly DuPont analysis data for A-share stocks to assess financial performance through return on equity decomposition.

Instructions

Quarterly Dupont analysis data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
yearYes
quarterYes
limitNo
formatNomarkdown

Implementation Reference

  • MCP tool handler for get_dupont_data. Decorated with @app.tool(), validates inputs indirectly via use case, delegates to fetch_dupont_data use case wrapped in run_tool_with_handling for error handling and caching.
    @app.tool() def get_dupont_data(code: str, year: str, quarter: int, limit: int = 250, format: str = "markdown") -> str: """Quarterly Dupont analysis data.""" return run_tool_with_handling( lambda: fetch_dupont_data(active_data_source, code=code, year=year, quarter=quarter, limit=limit, format=format), context=f"get_dupont_data:{code}:{year}Q{quarter}", )
  • mcp_server.py:51-58 (registration)
    Registration of all tool groups in the main MCP server, including financial_report_tools which defines and registers the get_dupont_data tool.
    register_stock_market_tools(app, active_data_source) register_financial_report_tools(app, active_data_source) register_index_tools(app, active_data_source) register_market_overview_tools(app, active_data_source) register_macroeconomic_tools(app, active_data_source) register_date_utils_tools(app, active_data_source) register_analysis_tools(app, active_data_source) register_helpers_tools(app)
  • Use case helper: fetch_dupont_data performs validation, fetches raw DataFrame from data_source, and formats output as markdown or other.
    def fetch_dupont_data(data_source: FinancialDataSource, *, code: str, year: str, quarter: int, limit: int, format: str) -> str: validate_year(year) validate_quarter(quarter) validate_output_format(format) df = data_source.get_dupont_data(code=code, year=year, quarter=quarter) return _format_financial_df(df, code=code, year=year, quarter=quarter, dataset="Dupont", format=format, limit=limit)
  • Data source implementation: get_dupont_data delegates to Baostock's query_dupont_data via shared _fetch_financial_data helper with error handling.
    def get_dupont_data(self, code: str, year: str, quarter: int) -> pd.DataFrame: """Fetches quarterly DuPont analysis data using Baostock.""" return _fetch_financial_data(bs.query_dupont_data, "DuPont Analysis", code, year, quarter)
  • Interface definition specifying the input schema (code: str, year: str, quarter: int) and output type (pd.DataFrame) for the data fetching method.
    @abstractmethod def get_dupont_data(self, code: str, year: str, quarter: int) -> 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