Skip to main content

Description

The Fetch Foreign Exchange API tool retrieves foreign exchange rates for a specified base currency using the external ExchangeRate-API service. This tool outputs conversion rates for multiple currencies, enabling agents to perform accurate financial calculations.
API Used: ExchangeRate-API
API Key: Set in .env file as EXCHANGE_RATE_API_KEY

Arguments

  • baseCurrency (string): The base currency code (e.g., USD, EUR, JPY). This currency is used as the reference for exchange rates.

Example Configuration

Response Handling

  • Successful Response: If the API request is successful, the function returns an object containing:
    • intention: The intention description provided by the user.
    • result: A list of exchange rates for multiple currencies relative to the base currency.
  • Error Handling: If the API request fails, an error is logged, and an error message is returned, indicating the failure reason.
Example Response: