Skip to main content
Glama
cfocoder

Banxico MCP Server

get_latest_usd_mxn_rate

Retrieve the current USD to MXN exchange rate from Mexico's central bank (Banxico) with the date of the rate.

Instructions

Get the latest USD/MXN exchange rate from Banxico.

Returns: The most recent USD/MXN exchange rate with date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the get_latest_usd_mxn_rate tool. It checks for the API token, fetches timely USD/MXN exchange rate data from Banxico's SIE API using the endpoint 'series/SF63528/datos/oportuno', handles errors, and formats the response using format_exchange_rate_data.
    async def get_latest_usd_mxn_rate() -> str:
        """
        Get the latest USD/MXN exchange rate from Banxico.
            
        Returns:
            The most recent USD/MXN exchange rate with date
        """
        if not BANXICO_TOKEN:
            return "Error: BANXICO_API_TOKEN environment variable not set. Please configure your API token."
        
        endpoint = "series/SF63528/datos/oportuno"
        data = await make_banxico_request(endpoint, BANXICO_TOKEN)
        
        if not data:
            return "Failed to retrieve exchange rate data. Please check your API token and network connection."
        
        return format_exchange_rate_data(data)

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/cfocoder/banxico_mcp'

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