Skip to main content
Glama
24mlight

A-Share MCP Server

get_balance_data

Retrieve quarterly balance sheet data for A-share stocks to analyze financial positions and track asset-liability changes over time.

Instructions

Quarterly balance sheet data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
yearYes
quarterYes
limitNo
formatNomarkdown

Implementation Reference

  • The primary handler function for the 'get_balance_data' MCP tool. Defined with @app.tool() decorator inside register_financial_report_tools. It wraps the use case logic with error handling and caching via run_tool_with_handling.
    @app.tool()
    def get_balance_data(code: str, year: str, quarter: int, limit: int = 250, format: str = "markdown") -> str:
        """Quarterly balance sheet data."""
        return run_tool_with_handling(
            lambda: fetch_balance_data(active_data_source, code=code, year=year, quarter=quarter, limit=limit, format=format),
            context=f"get_balance_data:{code}:{year}Q{quarter}",
        )
  • mcp_server.py:52-52 (registration)
    Top-level registration call that invokes register_financial_report_tools, which defines and registers the get_balance_data tool among other financial report tools.
    register_financial_report_tools(app, active_data_source)
  • Use case function that performs input validation, fetches raw balance sheet data from the data source, formats it as a table (markdown by default), and applies row limits.
    def fetch_balance_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_balance_data(code=code, year=year, quarter=quarter)
        return _format_financial_df(df, code=code, year=year, quarter=quarter, dataset="Balance Sheet", format=format, limit=limit)
  • Implementation in the BaostockDataSource class that queries the Baostock API for balance sheet data using a shared _fetch_financial_data helper.
    def get_balance_data(self, code: str, year: str, quarter: int) -> pd.DataFrame:
        """Fetches quarterly balance sheet data (solvency) using Baostock."""
        return _fetch_financial_data(bs.query_balance_data, "Balance Sheet", code, year, quarter)
  • Abstract method definition in FinancialDataSource interface, defining the expected signature for data source implementations.
    @abstractmethod
    def get_balance_data(self, code: str, year: str, quarter: int) -> pd.DataFrame:
        pass
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but provides none. It doesn't indicate whether this is a read-only operation, what permissions might be required, whether there are rate limits, what format the data returns in, or any error conditions. The description is purely declarative without behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise - a single three-word phrase. While this represents under-specification rather than ideal conciseness, from a structural perspective there's no wasted verbiage or redundancy. Every word carries semantic weight, even if insufficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters (3 required), 0% schema description coverage, no annotations, and no output schema, the description is completely inadequate. It provides minimal context about what the tool does and no information about how to use it effectively, what to expect in return, or any behavioral characteristics.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning none of the 5 parameters have descriptions in the schema. The tool description provides no information about what 'code', 'year', 'quarter', 'limit', or 'format' mean, their expected formats, or how they affect the query. This leaves all parameters completely undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Quarterly balance sheet data' is tautological - it essentially restates the tool name 'get_balance_data' without specifying the action. While it indicates the resource type (balance sheet data) and temporal scope (quarterly), it lacks a clear verb and doesn't distinguish this from sibling tools like get_cash_flow_data or get_profit_data that also retrieve financial data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention any specific use cases, prerequisites, or comparisons to sibling tools like get_fina_indicator or get_stock_basic_info that might provide related financial information. Users must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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