Skip to main content
Glama
24mlight

A-Share MCP Server

get_recent_trading_range

Calculate date ranges for recent trading periods to analyze stock market data within specified timeframes.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNo

Implementation Reference

  • The 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.
    @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}",
        )
  • mcp_server.py:56-56 (registration)
    The call to register_date_utils_tools, which includes the registration of the get_recent_trading_range tool via @app.tool() decorators.
    register_date_utils_tools(app, active_data_source)
  • Core helper function implementing the logic to compute the recent trading range by fetching trading days and selecting the last N days.
    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]}"
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 of behavioral disclosure. It states the tool returns a 'date range string' but doesn't specify the format (e.g., 'YYYY-MM-DD to YYYY-MM-DD'), whether it excludes non-trading days like weekends/holidays, or if there are any rate limits or errors for invalid inputs. This leaves gaps in understanding the tool's behavior beyond its basic function.

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, well-structured sentence that efficiently conveys the core functionality without unnecessary words. It is front-loaded with the main action and resource, making it easy to parse and understand quickly.

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?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate but incomplete. It covers the basic purpose but lacks details on parameter semantics, behavioral traits, and usage context, which are needed for effective tool invocation in a financial data environment with many sibling tools.

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 input schema has one parameter ('days') with 0% description coverage, and the description adds minimal semantics by implying 'days' refers to 'trading days' and has a default (implied by 'recent N trading days'). However, it doesn't clarify the range, units, or handling of edge cases (e.g., negative values), so it partially compensates but not fully for the low schema coverage.

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'), making it easy to understand what the tool does. However, it doesn't explicitly distinguish it from sibling tools like 'get_last_n_trading_days' or 'get_trade_dates', which appear related to trading date queries.

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, constraints, or comparisons to sibling tools such as 'get_last_n_trading_days' or 'get_trade_dates', leaving the agent to infer usage context based on the name and description 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