Skip to main content
Glama
aahl

MCP Server for stock and crypto

by aahl

A股龙虎榜统计

stock_lhb_ggtj_sina

Retrieve statistics of stocks listed on the Dragon and Tiger Board for Shanghai and Shenzhen A-share markets. Set the number of days and result limit.

Instructions

获取中国A股市场(上证、深证)的龙虎榜个股上榜统计数据

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo统计最近天数,仅支持: [5/10/30/60]5
limitNo返回数量(int,30-100)

Implementation Reference

  • Handler function that fetches A-share LHB (龙虎榜) statistics from akshare by calling ak.stock_lhb_ggtj_sina with symbol=days, caches result for 3600s, limits to 'limit' rows, and returns CSV string.
    def stock_lhb_ggtj_sina(
        days: str = Field("5", description="统计最近天数,仅支持: [5/10/30/60]"),
        limit: int = Field(50, description="返回数量(int,30-100)", strict=False),
    ):
        dfs = ak_cache(ak.stock_lhb_ggtj_sina, symbol=days, ttl=3600)
        dfs = dfs.head(int(limit))
        return dfs.to_csv(index=False, float_format="%.2f").strip()
  • Input parameters: days (str, default '5', options: 5/10/30/60) and limit (int, default 50, range 30-100).
    days: str = Field("5", description="统计最近天数,仅支持: [5/10/30/60]"),
    limit: int = Field(50, description="返回数量(int,30-100)", strict=False),
  • Registration decorator using @mcp.tool with title 'A股龙虎榜统计' and description.
    @mcp.tool(
        title="A股龙虎榜统计",
        description="获取中国A股市场(上证、深证)的龙虎榜个股上榜统计数据",
    )
  • Caching helper function that wraps akshare calls with dual-layer cache (TTLCache + diskcache) to avoid redundant API requests.
    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

B3.3/5.0
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It only states the core purpose and does not mention read-only nature, data source (Sina, only in tool name), rate limits, pagination, or return format. The schema covers the '仅支持' constraint for days, but the description adds no 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 a single, grammatically correct sentence with no filler. It front-loads the action and resource, being appropriately concise for a simple lookup tool.

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?

While the tool is simple (two fully-documented optional parameters), the absence of an output schema means the description should explain return values. It does not, leaving a gap. However, the core purpose is clear enough for basic usage, making it 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%, with both days and limit having descriptions. The tool description adds no parameter-specific meaning beyond the schema, so the baseline 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 clearly states the verb '获取' (get) and the specific resource: 龙虎榜个股上榜统计数据 (Dragon-Tiger List individual stock statistics) for A-shares in Shanghai and Shenzhen. This differentiates from sibling tools like stock_zt_pool_em (limit-up pool) and northbound_funds.

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?

No guidance is given on when to use this tool versus alternatives such as stock_zt_pool_em or stock_sector_fund_flow_rank. There are no exclusions, prerequisites, or recommended scenarios described.

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