Skip to main content
Glama
24mlight

A-Share MCP Server

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 primary MCP tool handler for 'get_cash_flow_data'. It is registered using @app.tool() decorator, performs error handling via run_tool_with_handling, and delegates to the use case fetch_cash_flow_data.
    @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}", )
  • Helper use case function that validates inputs (year, quarter, format), fetches raw data from data_source, and formats it into a markdown table.
    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)
  • Abstract method definition in the data source interface, specifying the input parameters and return type for cash flow data retrieval.
    @abstractmethod def get_cash_flow_data(self, code: str, year: str, quarter: int) -> pd.DataFrame: pass
  • Concrete implementation of get_cash_flow_data in Baostock data source, delegating to a shared _fetch_financial_data helper that calls the Baostock API.
    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)

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