Skip to main content
Glama
ariesanhthu

VNStock MCP Server

by ariesanhthu

get_gold_price

Retrieve current or historical gold prices from Vietnam's stock market sources like SJC or BTMC in JSON or dataframe format.

Instructions

Get gold price from stock market
Args:
    date: str = None (if None, return today's price. Format: YYYY-MM-DD)
    source: Literal['SJC', 'BTMC'] = 'SJC' (source to get gold price)
    output_format: Literal['json', 'dataframe'] = 'json'
Returns:
    pd.DataFrame

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo
sourceNoSJC
output_formatNojson

Implementation Reference

  • The primary handler implementation for the 'get_gold_price' MCP tool. It is registered via the @server.tool() decorator, defines the input schema via type annotations and defaults, and executes the logic by calling underlying vnstock functions (sjc_gold_price or btmc_goldprice) based on parameters, formatting output as JSON or pandas DataFrame.
    @server.tool()
    def get_gold_price(
        date: str = None,
        source: Literal["SJC", "BTMC"] = "SJC",
        output_format: Literal["json", "dataframe"] = "json",
    ):  # pyright: ignore[reportUndefinedVariable]  # noqa: F821
        """
        Get gold price from stock market
        Args:
            date: str = None (if None, return today's price. Format: YYYY-MM-DD)
            source: Literal['SJC', 'BTMC'] = 'SJC' (source to get gold price)
            output_format: Literal['json', 'dataframe'] = 'json'
        Returns:
            pd.DataFrame
        """
        if date:
            price = sjc_gold_price(date=date)
            if output_format == "json":
                return price.to_json(orient="records", force_ascii=False)
            else:
                return price
        else:
            price = sjc_gold_price() if source == "SJC" else btmc_goldprice()
            if output_format == "json":
                return price.to_json(orient="records", force_ascii=False)
            else:
                return price

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