Skip to main content
Glama
ariesanhthu

VNStock MCP Server

by ariesanhthu

get_quote_history_price

Retrieve historical stock price data for Vietnam market symbols within specified date ranges and intervals to analyze market trends.

Instructions

Get quote price history of a symbol from stock market
Args:
    symbol: str (symbol to get history price)
    start_date: str (format: YYYY-MM-DD)
    end_date: str = None (end date to get history price. None means today)
    interval: Literal['1m', '5m', '15m', '30m', '1H', '1D', '1W', '1M'] = '1D' (interval to get history price)
    output_format: Literal['json', 'dataframe'] = 'json'
Returns:
    pd.DataFrame

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
start_dateYes
end_dateNo
intervalNo1D
output_formatNojson

Implementation Reference

  • The main handler function for the 'get_quote_history_price' tool. Decorated with @server.tool() which registers it in the FastMCP server. Implements the core logic using vnstock.Quote to fetch historical price data and format as JSON or pandas DataFrame.
    @server.tool()
    def get_quote_history_price(
        symbol: str,
        start_date: str,
        end_date: str = None,
        interval: Literal["1m", "5m", "15m", "30m", "1H", "1D", "1W", "1M"] = "1D",
        output_format: Literal["json", "dataframe"] = "json",
    ):  # pyright: ignore[reportUndefinedVariable]  # noqa: F722
        """
        Get quote price history of a symbol from stock market
        Args:
            symbol: str (symbol to get history price)
            start_date: str (format: YYYY-MM-DD)
            end_date: str = None (end date to get history price. None means today)
            interval: Literal['1m', '5m', '15m', '30m', '1H', '1D', '1W', '1M'] = '1D' (interval to get history price)
            output_format: Literal['json', 'dataframe'] = 'json'
        Returns:
            pd.DataFrame
        """
        quote = Quote(symbol=symbol, source="VCI")
        df = quote.history(
            start_date=start_date,
            end_date=end_date or datetime.now().strftime("%Y-%m-%d"),
            interval=interval,
        )
        if output_format == "json":
            return df.to_json(orient="records", force_ascii=False)
        else:
            return df
  • The @server.tool() decorator registers the get_quote_history_price function as an MCP tool with the name matching the function name.
    @server.tool()
  • Function signature with type annotations defining the input schema for the tool, including parameters and their types/constraints.
    def get_quote_history_price(
        symbol: str,
        start_date: str,
        end_date: str = None,
        interval: Literal["1m", "5m", "15m", "30m", "1H", "1D", "1W", "1M"] = "1D",
        output_format: Literal["json", "dataframe"] = "json",
    ):  # pyright: ignore[reportUndefinedVariable]  # noqa: F722
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It mentions the return type ('pd.DataFrame') but lacks critical details: it doesn't specify data sources, rate limits, authentication needs, error handling, or whether it's a read-only operation. For a financial data tool with no annotations, this is insufficient transparency.

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?

The description is well-structured with a clear purpose statement followed by parameter details in a bullet-like format. It's appropriately sized for a 5-parameter tool, with no redundant information. However, the 'Returns' section could be integrated more smoothly, and the formatting is slightly verbose.

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 complexity (5 parameters, financial data) and lack of annotations or output schema, the description is moderately complete. It covers parameters well but misses behavioral context like data freshness, limitations, or error cases. Without an output schema, the 'pd.DataFrame' return hint is helpful but minimal, leaving gaps in understanding the tool's full behavior.

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?

The description adds significant semantic value beyond the input schema, which has 0% description coverage. It explains each parameter clearly: 'symbol' as the stock symbol, date formats, default behaviors (e.g., 'None means today'), interval options with literals, and output format choices. This fully compensates for the schema's lack of descriptions.

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: 'Get quote price history of a symbol from stock market.' It specifies the verb ('get') and resource ('quote price history'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_quote_intraday_price' or 'get_price_board', which prevents a perfect score.

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 sibling tools like 'get_quote_intraday_price' for real-time data or 'get_price_board' for current prices, nor does it specify prerequisites or exclusions. This leaves the agent without context for tool selection.

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/ariesanhthu/mcp-server-vietnam-stock-trading'

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