Skip to main content
Glama
24mlight

A Share MCP

get_recent_trading_range

Calculate date ranges for recent trading periods to analyze A-share market data, supporting historical price queries and financial analysis.

Instructions

Return a date range string covering the recent N trading days.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo

Implementation Reference

  • MCP tool handler for get_recent_trading_range. It is decorated with @app.tool() and delegates execution to the use case layer via run_tool_with_handling for error handling and logging.
    @app.tool()
    def get_recent_trading_range(days: int = 5) -> str:
        """Return a date range string covering the recent N trading days."""
        return run_tool_with_handling(
            lambda: uc_date.get_recent_trading_range(active_data_source, days=days),
            context=f"get_recent_trading_range:{days}",
        )
  • Core implementation logic for computing the recent trading range. Fetches trading days from data source and formats the date range string.
    def get_recent_trading_range(data_source: FinancialDataSource, *, days: int) -> str:
        today = datetime.now()
        start = (today - timedelta(days=days * 2)).strftime("%Y-%m-%d")
        end = today.strftime("%Y-%m-%d")
        df = _fetch_trading_days(data_source, start_date=start, end_date=end)
        trading_days = df[df["is_trading_day"] == "1"]["calendar_date"].tolist()
        if not trading_days:
            return ""
        return f"{trading_days[-days]} 至 {trading_days[-1]}" if len(trading_days) >= days else f"{trading_days[0]} 至 {trading_days[-1]}"
  • mcp_server.py:56-56 (registration)
    Invocation of the register_date_utils_tools function in the main MCP server setup, which registers the get_recent_trading_range tool among others.
    register_date_utils_tools(app, active_data_source)
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 mentions returning a 'date range string' but lacks details on format (e.g., 'YYYY-MM-DD to YYYY-MM-DD'), timezone, handling of non-trading days, or error behavior. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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, efficient sentence that directly states the tool's function without unnecessary words. It is appropriately sized and front-loaded, making it easy to understand quickly.

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 no annotations, no output schema, and low schema description coverage (0%), the description is incomplete. It doesn't explain the return format, error handling, or how 'trading days' are defined (e.g., excludes weekends/holidays). For a tool with one parameter and potential complexity in date calculations, more context is needed.

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?

The description adds minimal semantics beyond the input schema. It explains that 'days' parameter relates to 'recent N trading days', but with 0% schema description coverage and only one parameter, this is insufficient to fully compensate. The baseline is 4 for zero parameters, but here there is one parameter with poor coverage, so a 3 is appropriate as it provides some context but not detailed meaning.

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 clearly states the tool's purpose: 'Return a date range string covering the recent N trading days.' It specifies the verb ('Return'), resource ('date range string'), and scope ('recent N trading days'). However, it doesn't explicitly differentiate from sibling tools like 'get_last_n_trading_days' or 'get_trade_dates', which appear related to trading date retrieval.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, exclusions, or compare it to sibling tools such as 'get_last_n_trading_days' or 'get_trade_dates', which could serve similar or overlapping functions.

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