Skip to main content
Glama
ariesanhthu

VNStock MCP Server

by ariesanhthu

get_exchange_rate

Retrieve exchange rates for all currency pairs from Vietnam's stock market. Specify a date or get today's rates in JSON or dataframe format.

Instructions

Get exchange rate of all currency pairs from stock market
Args:
    date: str = None (if None, return today's price. Format: YYYY-MM-DD)
    output_format: Literal['json', 'dataframe'] = 'json'
Returns:
    pd.DataFrame

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo
output_formatNojson

Implementation Reference

  • The handler function for the 'get_exchange_rate' MCP tool. Decorated with @server.tool() for automatic registration and schema inference from type hints and docstring. Fetches exchange rates using the vnstock library's vcb_exchange_rate function.
    @server.tool()
    def get_exchange_rate(
        date: str = None, output_format: Literal["json", "dataframe"] = "json"
    ):
        """
        Get exchange rate of all currency pairs from stock market
        Args:
            date: str = None (if None, return today's price. Format: YYYY-MM-DD)
            output_format: Literal['json', 'dataframe'] = 'json'
        Returns:
            pd.DataFrame
        """
        if not date:
            date = datetime.now().strftime("%Y-%m-%d")
        price = vcb_exchange_rate(date=date)
        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