Skip to main content
Glama
aahl

MCP Server for stock and crypto

by aahl

A股涨停股池

stock_zt_pool_em

Retrieves all stocks that hit the daily price limit (涨停) in China's A-share markets, with optional date and count parameters.

Instructions

获取中国A股市场(上证、深证)的所有涨停股票

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo交易日日期(可选),默认为最近的交易日,格式: 20251231
limitNo返回数量(int,30-100)

Implementation Reference

  • The function that executes the stock_zt_pool_em tool logic: fetches the daily limit-up (涨停) stock pool from akshare, drops unnecessary columns, sorts by turnover amount, limits results, and returns as CSV text.
    def stock_zt_pool_em(
        date: str = Field("", description="交易日日期(可选),默认为最近的交易日,格式: 20251231"),
        limit: int = Field(50, description="返回数量(int,30-100)", strict=False),
    ):
        if not date:
            date = recent_trade_date().strftime("%Y%m%d")
        dfs = ak_cache(ak.stock_zt_pool_em, date=date, ttl=1200)
        cnt = len(dfs)
        try:
            dfs.drop(columns=["序号", "流通市值", "总市值"], inplace=True)
        except Exception:
            pass
        dfs.sort_values("成交额", ascending=False, inplace=True)
        dfs = dfs.head(int(limit))
        desc = f"共{cnt}只涨停股\n"
        return desc + dfs.to_csv(index=False, float_format="%.2f").strip()
  • Registration of stock_zt_pool_em as an MCP tool using the @mcp.tool decorator with title and description metadata.
    @mcp.tool(
        title="A股涨停股池",
        description="获取中国A股市场(上证、深证)的所有涨停股票",
    )
  • Input parameter schema for stock_zt_pool_em: date (optional string) and limit (int, default 50, range 30-100).
        date: str = Field("", description="交易日日期(可选),默认为最近的交易日,格式: 20251231"),
        limit: int = Field(50, description="返回数量(int,30-100)", strict=False),
    ):
  • Helper function to find the most recent trading date, used when no date is provided to stock_zt_pool_em.
    def recent_trade_date():
        now = datetime.now().date()
        dfs = ak_cache(ak.tool_trade_date_hist_sina, ttl=43200)
        if dfs is None:
            return now
        dfs.sort_values("trade_date", ascending=False, inplace=True)
        for d in dfs["trade_date"]:
            if d <= now:
                return d
        return now
  • Helper caching function that wraps akshare API calls with in-memory and disk caching (TTL-based), used to call ak.stock_zt_pool_em with a 1200-second TTL cache.
    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. Addedv1.0.0

TDQS

C2.9/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 the full burden. It claims to return 'all' limit-up stocks, but the limit parameter (default 50, range 30-100) contradicts this, indicating a cap on results. The description does not disclose this limitation, nor any other behavioral details like rate limits or return format.

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?

A single, concise sentence that immediately states the tool's purpose with no filler words. It is well structured and front-loaded.

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

Completeness2/5

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

Given the lack of an output schema and annotations, the description should explain what data is returned (e.g., stock codes, names, statistics) and clarify the limit cap. It fails to do so, making the description incomplete for a tool that returns a data pool.

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?

Both parameters are already fully described in the schema (date format and limit range/default), giving 100% schema coverage. The description adds no additional meaning beyond the schema, so the baseline score of 3 is appropriate.

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

Purpose4/5

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

The description uses the specific verb '获取' (get) and identifies the resource as all limit-up stocks in China's A-share market (Shanghai, Shenzhen), clearly stating the tool's function. However, it does not distinguish itself from the sibling tool stock_zt_pool_strong_em, which likely serves a similar purpose.

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

Usage Guidelines2/5

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

There is no guidance on when to use this tool versus alternatives. The description does not mention any conditions, exclusions, or prerequisites, and the optional date/limit parameters are only documented in the schema, not in usage context.

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