Skip to main content
Glama
24mlight

A Share MCP

previous_trading_day

Calculate the previous trading day for A-share market analysis by inputting any date to identify valid market days for historical data review and trading strategy planning.

Instructions

Get the previous trading day before the given date.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateYes

Implementation Reference

  • The MCP tool handler for 'previous_trading_day', decorated with @app.tool(). It wraps the use case function with error handling via run_tool_with_handling.
    @app.tool()
    def previous_trading_day(date: str) -> str:
        """Get the previous trading day before the given date."""
        return run_tool_with_handling(
            lambda: uc_date.previous_trading_day(active_data_source, date=date),
            context=f"previous_trading_day:{date}",
        )
  • mcp_server.py:56-56 (registration)
    Invocation of register_date_utils_tools which defines and registers the date utils tools, including 'previous_trading_day', to the FastMCP app.
    register_date_utils_tools(app, active_data_source)
  • Core implementation of previous_trading_day logic: fetches trading days in a 31-day window before the given date and returns the most recent trading day prior to it.
    def previous_trading_day(data_source: FinancialDataSource, *, date: str) -> str:
        target = datetime.strptime(date, "%Y-%m-%d")
        start = (target - timedelta(days=31)).strftime("%Y-%m-%d")
        df = _fetch_trading_days(data_source, start_date=start, end_date=date)
        days = df[df["is_trading_day"] == "1"]["calendar_date"].tolist()
        prev = max([d for d in days if d < date], default=None)
        return prev or date
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the basic operation. It doesn't disclose behavioral traits such as how holidays/weekends are handled, timezone considerations, error handling for invalid dates, or the return format (e.g., date string, object). This is inadequate for a tool with zero annotation coverage.

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 front-loads the core purpose without unnecessary words. Every part of the sentence contributes directly to understanding the tool's function, making it appropriately sized for its simplicity.

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 annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't explain what 'trading day' means in this context (e.g., market-specific), how edge cases are handled, or what the return value looks like. For a date-calculation tool in a financial context, more contextual information is needed.

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

Parameters2/5

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

The input schema has 0% description coverage, and the tool description doesn't add any parameter semantics. It mentions 'the given date' but doesn't specify the expected format (e.g., YYYY-MM-DD), validation rules, or examples. With one undocumented parameter, the description fails to compensate for the schema gap.

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 verb ('Get') and resource ('previous trading day') with a specific condition ('before the given date'). It distinguishes from siblings like 'get_last_n_trading_days' by focusing on a single previous day, but doesn't explicitly differentiate from 'next_trading_day' or 'is_trading_day' beyond the directional aspect.

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 provided on when to use this tool versus alternatives like 'get_last_n_trading_days' for multiple days, 'is_trading_day' for validation, or 'get_trade_dates' for date lists. The description implies usage for date calculation but offers no context about prerequisites, exclusions, or comparison with sibling tools.

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