Skip to main content
Glama
aahl

MCP Server for stock and crypto

by aahl

A股关键指标

stock_indicators_a

Retrieve key financial report indicators for Chinese A-share stocks from Shanghai and Shenzhen exchanges using a stock symbol.

Instructions

获取中国A股市场(上证、深证)的股票财务报告关键指标

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes股票代码

Implementation Reference

  • The handler function for the 'stock_indicators_a' tool. It calls ak_cache with ak.stock_financial_abstract_ths using the provided symbol, converts the result to CSV, and returns only the header row plus the last 15 rows of data.
    def stock_indicators_a(
        symbol: str = field_symbol,
    ):
        dfs = ak_cache(ak.stock_financial_abstract_ths, symbol=symbol)
        keys = dfs.to_csv(index=False, float_format="%.3f").strip().split("\n")
        return "\n".join([keys[0], *keys[-15:]])
  • The @mcp.tool decorator registering stock_indicators_a as an MCP tool with title 'A股关键指标' and description '获取中国A股市场(上证、深证)的股票财务报告关键指标'.
    @mcp.tool(
        title="A股关键指标",
        description="获取中国A股市场(上证、深证)的股票财务报告关键指标",
    )
  • The input parameter schema: 'symbol' is a string using the shared 'field_symbol' field descriptor (description: '股票代码').
        symbol: str = field_symbol,
    ):
  • The ak_cache helper function used by stock_indicators_a to cache and fetch data. It wraps akshare API calls with a two-layer cache (in-memory TTLCache + diskcache).
    def ak_cache(fun, *args, **kwargs) -> pd.DataFrame | None:
        key = kwargs.pop("key", None)
        if not key:
            key = f"{fun.__name__}-{args}-{kwargs}"
        ttl1 = kwargs.pop("ttl", 86400)
        ttl2 = kwargs.pop("ttl2", None)
        cache = CacheKey.init(key, ttl1, ttl2)
        all = cache.get()
        if all is None:
            try:
                _LOGGER.info("Request akshare: %s", [key, args, kwargs])
                all = fun(*args, **kwargs)
                cache.set(all)
            except Exception as exc:
                _LOGGER.exception(str(exc))
        return all

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description carries full responsibility for behavioral disclosure. It only states the basic function and market scope, without mentioning data source, update frequency, potential limitations, or any other behavioral characteristics. The description adds minimal context beyond the title.

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 a single, concise sentence that front-loads the essential information: what the tool does and its market scope. There is no redundant or filler content.

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

Completeness3/5

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

With only one parameter and no output schema, the description is fairly simple. However, it does not clarify what 'key indicators' are included, which could be important for an agent deciding whether to use this tool. The absence of an output schema increases the need for such detail, making the description only minimally viable.

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

Parameters3/5

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

Schema description coverage is 100% because the 'symbol' parameter has the description '股票代码' (stock code). The tool description adds no additional parameter semantics beyond the schema, so a baseline of 3 is appropriate.

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

Purpose5/5

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

The description uses a specific verb '获取' (retrieve) and a clear resource '股票财务报告关键指标' (key financial report indicators). It explicitly scopes to China's A-share market (Shanghai, Shenzhen), which distinguishes it from sibling tools like stock_indicators_hk and stock_indicators_us. The purpose is unambiguous.

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

Usage Guidelines3/5

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

The description implies usage for A-share stocks by specifying the market, but it does not explicitly state when to use this tool versus alternatives or mention any exclusions. No alternative tools are referenced. Usage is inferred rather than articulated.

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