Skip to main content
Glama
jamesdingAI

stockreport-mcp

by jamesdingAI

get_historical_k_data

Fetch historical OHLCV data for Chinese A-share stocks with customizable date ranges, frequencies, and adjustment options to support technical analysis and market research.

Instructions

    Fetches historical K-line (OHLCV) data for a Chinese A-share stock.

    Args:
        code: The stock code in Baostock format (e.g., 'sh.600000', 'sz.000001').
        start_date: Start date in 'YYYY-MM-DD' format.
        end_date: End date in 'YYYY-MM-DD' format.
        frequency: Data frequency. Valid options (from Baostock):
                     'd': daily
                     'w': weekly
                     'm': monthly
                     '5': 5 minutes
                     '15': 15 minutes
                     '30': 30 minutes
                     '60': 60 minutes
                   Defaults to 'd'.
        adjust_flag: Adjustment flag for price/volume. Valid options (from Baostock):
                       '1': Forward adjusted (后复权)
                       '2': Backward adjusted (前复权)
                       '3': Non-adjusted (不复权)
                     Defaults to '3'.
        fields: Optional list of specific data fields to retrieve (must be valid Baostock fields).
                If None or empty, default fields will be used (e.g., date, code, open, high, low, close, volume, amount, pctChg).

    Returns:
        A Markdown formatted string containing the K-line data table, or an error message.
        The table might be truncated if the result set is too large.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
start_dateYes
end_dateYes
frequencyNod
adjust_flagNo3
fieldsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries full burden and does well: it discloses output format (Markdown table), potential truncation for large results, error message returns, and data source specifics (Baostock format/options). It doesn't mention rate limits, authentication needs, or data freshness, but covers key behavioral aspects for a read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear sections (purpose, Args, Returns) and no wasted sentences. The parameter explanations are detailed but necessary given 0% schema coverage. Slightly verbose due to enum listings, but each line earns its place by providing critical semantic information.

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

Completeness5/5

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

Given 6 parameters with 0% schema coverage, no annotations, but with output schema present, the description provides complete context: clear purpose, detailed parameter semantics, output format disclosure, and behavioral notes (truncation, errors). It fully compensates for the lack of structured metadata, making the tool understandable for an AI agent.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must fully compensate - and it does excellently. Each parameter gets detailed semantics: code format examples, date formats, frequency/enum mappings with explanations, adjust_flag meanings with Chinese terms, and fields behavior with defaults. This adds substantial value beyond the bare schema.

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 specific action ('fetches historical K-line (OHLCV) data') and resource ('for a Chinese A-share stock'), distinguishing it from siblings like 'get_hk_historical_k_data' (Hong Kong stocks) and 'get_us_historical_k_data' (US stocks). It precisely identifies the data type and market scope.

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

Usage Guidelines4/5

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

The description implicitly suggests usage for Chinese A-share stocks (vs. HK/US siblings), but lacks explicit when-not-to-use guidance or named alternatives. It provides context about data source (Baostock) and format, which helps in tool selection, but doesn't explicitly compare to other data-fetching tools like 'get_stock_realtime_data'.

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/jamesdingAI/stockreport-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server