Skip to main content
Glama
24mlight

A Share MCP

get_cash_flow_data

Retrieve quarterly cash flow data for A-share stocks to analyze financial performance and liquidity metrics.

Instructions

Quarterly cash flow data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
yearYes
quarterYes
limitNo
formatNomarkdown

Implementation Reference

  • The main handler function for the 'get_cash_flow_data' tool, decorated with @app.tool(). It wraps the use case execution with error handling via run_tool_with_handling and provides the tool's docstring and signature defining input/output schema.
    @app.tool() def get_cash_flow_data(code: str, year: str, quarter: int, limit: int = 250, format: str = "markdown") -> str: """Quarterly cash flow data.""" return run_tool_with_handling( lambda: fetch_cash_flow_data(active_data_source, code=code, year=year, quarter=quarter, limit=limit, format=format), context=f"get_cash_flow_data:{code}:{year}Q{quarter}", )
  • mcp_server.py:52-52 (registration)
    The call to register_financial_report_tools, which defines and registers the get_cash_flow_data tool among others, passing the MCP app and active data source.
    register_financial_report_tools(app, active_data_source)
  • The use case function fetch_cash_flow_data that performs input validation, fetches raw data from the data source, and formats the output as markdown or other specified format.
    def fetch_cash_flow_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_cash_flow_data(code=code, year=year, quarter=quarter) return _format_financial_df(df, code=code, year=year, quarter=quarter, dataset="Cash Flow", format=format, limit=limit)
  • The concrete implementation in BaostockDataSource that calls the Baostock API bs.query_cash_flow_data via a shared helper _fetch_financial_data to retrieve the raw DataFrame.
    def get_cash_flow_data(self, code: str, year: str, quarter: int) -> pd.DataFrame: """Fetches quarterly cash flow data using Baostock.""" return _fetch_financial_data(bs.query_cash_flow_data, "Cash Flow", code, year, quarter)
  • The abstract method definition in the FinancialDataSource interface, defining the expected signature for cash flow data retrieval.
    @abstractmethod def get_cash_flow_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