This guide will show you how to create a flexible tool for your Bolna Voice AI agent that can retrieve the current date and time from anywhere in the world. By using a dynamic parameter for the timezone, your agent can intelligently respond to user queries like “What time is it in Paris?”. We will use WorldTimeAPI, a free service that requires no API key or backend setup. The entire configuration is done within a single JSON object.

Complete JSON Payload

Add the following JSON object to your Bolna agent’s custom tools configuration.
{
  "name": "getcurrentdatetime",
  "description": "Fetches the current date and time for a specific timezone. Use this when a user asks for the time, especially if they mention a city, country, or region.",
  "pre_call_message": "Just a moment, I'm getting the local time for you.",
  "parameters": {
    "type": "object",
    "properties": {
      "timezone": {
        "type": "string",
        "description": "The timezone to get the current time for, in 'Area/Location' format like 'America/New_York' or 'Europe/London'. If the user does not specify a timezone, default to 'Etc/UTC'."
      }
    }
  },
  "key": "custom_task",
  "value": {
    "method": "GET",
    "param": {},
    "url": "http://worldtimeapi.org/api/timezone/%(timezone)s",
    "api_token": null,
    "headers": {}
  }
}

Configuration Properties

PropertyDescription
DescriptionA detailed description that guides the LLM to use the function for timezone-specific queries.
Try to make it as descriptive as possible for the LLM to execute this function successfully.
Timezone (parameter)This parameter is defined for the LLM. Its description guides the AI on the required Area/Location format and provides a default (Etc/UTC) if the user doesn’t specify a location.
URLThe API endpoint that includes a %(timezone)s placeholder. Bolna automatically substitutes this placeholder with the value of the timezone parameter before making the API call.
Timezone ListYou can find a full list of valid timezones here to understand the format required by the API.