N8n CalDav Agent Prompting

Describe the problem/error/question

Hi everyone,
I am currently trying to create an appointment assistant. Although there are many solutions to this all of them use Google Calendar, but the Calendar that I am using is in NextCloud and n8n does not have a node that exactly support this kind of action. What I found though is community CalDav node that has everything I am looking for (It can create, delete and get events from a calendar, in this situation from NextCloud: n8n-nodes-caldav-calendar - npm). The community node, according to its documentation, supports different time zones. So I am not aware if the problem has to do with my prompting or that there may be a bug in the node itself so I am going with the assumption that I am unable to prompt the agent correctly.

The problem that I am facing with this node has to do with the Get function of the CalDav Tool. What the agent should do when someone wants to make an appointment is first to check in the calendar which time slots are available for the provided date by the user. What the node does though is it reads the calendar in UTC timezone although the environment that I host it in and the calendar itself are both in Europe/Berlin Timezone.

e.g. Time slot between 09:00 - 09:30 (CEST) is already taken, the Agent uses CalDav Get and reads that 07:00 - 07:30 (UTC) is already taken which leads it to believe that 09:00 is an available time (which is not true).

All kinds of prompts that I tried never manage to work. Telling it to convert everything in to local time zone with {{$now}}, even manually telling it to add +2 hours to every time slot didn’t work and I am honestly out of solutions.

If any of you have encountered something similar and have a solution or ideas please let me know, I would really appreciate any kind of help. Thanks :grin:

Screenshots:

First off: here is what the tool looks like

I put some test appointments with which I am testing if the Calendar check works.

On the photo is the output from the CalDav Tool, which lists the appointments on a certain date. As you can see it is listed as 07:00 until 07:30 when in reality it is 09:00 - 09:30 in the calendar

image

And this is the reply that I get from the agent, suggesting time slots that are already busy

Information on your n8n setup

  • n8n version: 1.107.4
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 11

Hey,

I did check the configuration of the node and unfortunately the isn’t an option to specify a timezone.

When it comes to the function node though, am I understanding it correctly:

after the agent gathers the busy time slots from the calendar it sends them to a function node, the time conversion happens and then the converted data gets sent to the agent again or is there a different logic behind it.

Unfortunately I haven’t.

I tried to do it with the code node, now I am trying a solution with a date & time tool, but what it does is randomly add 2 hours on top of the already converted times.

The date and time tool receives the output from the CalDav tool which says at what time there is a busy appointment (in UTC) and converts it in to local Europe/ Berlin time which I have specified in the Agent’s tool usage.
Input

Output:


Which seems to be correct, but at the same time for some reason all time slots it suggests are incorrect and do not match the instructions that I am giving him.
For example people with a certain role must get different time slots (some get in the morning, some in the afternoon) and the agent now ignores that and gives time slots that should not be given to a specific role.


When in reality only time slots between 9 and 11:30 should be suggested for this role

The role handling is set up in the prompt of the agent and it worked correctly before adding the time and date tool.
Date & Time Tool


Agent’s Prompt
”Date and Time - This tool will be used to convert all time stamps and time slots in to Local time (Europe/ Berlin)”

Role handling (at the beginning they are asked for their role and it is saved)
”The available office hours are:
Monday until Friday
Morning block: 09:00-12:00
Afternoon block: 13:00-16:00
(Never offer times between 12:01 and 12:59)

Do not offer any time slots that fall outside of these hours.

If a user has the Student role offer them time slots in the morning block
If a user has the Professor or Staff Member role offer them time slots in the afternoon block
”

This is the prompt that I have put for checking the busy calendar time slots, but it still sometimes doesn’t even use the date & time tool to convert anything although it is specified

”#CalDav Check

You must check that a full 30- minute block is available:
→ The start and end time must not conflict with any existing calendar event.
->After collecting all appointments for the specific with “CalDav Check Slots” you must always use the “Date time” tool to convert dtStartISO in to local time
→ the output from the “date time” tool are times that are considered unavailable and must never be suggested to the user
→ The time slots that you must suggest are the ones that do not match the above criteria
”

Hello,

I continued experimenting and rewrote my time slot checking prompt so its more compact and easy to understand for the agent. Time conversion has managed to work correctly.

Now the problem that I am facing is the displaying of free time slots. What the agent does is it sometimes displays the correct available time slots and other times it suggests that there are no available slots although there clearly are many.

Here is the output from the Think tool:

and here is the new prompting that I used
”To know which time slots are not busy, you must strictly follow the following workflow

1.Use “CalDav Check Slots” to Get any events that are happening on the date given by the user

  • If you run in to an error, that there are no events on that date, that means that all time slots are available

1.1 If you get events that are happening on the date then you must do the following:

  • Since the information in “CalDav Check Slots” is in a different time zone, you must
  • always convert the starting time of the events in to local time with the use of “Date & Time” tool
    the converted times get output in the Output Field “localTime”

e.g.
" 2025-08-25T08:30:00.000Z gets converted in to 2025-08-25T10:30:00.000+02:00
2025-08-26T09:30:00.000Z gets converted in to 2025-08-26T11:30:00.000+02:00
etc…"

The time slots in the Output Field “localTime” from “Date & Time” tool are not available and must not be offered to the user.

Use this example to understand the logic behind determining if a time slot is available:

If the output from “Date & Time” tool is:
localTime:2025-08-29T09:00:00.000+02:00
that means that the time slot 09:00 - 09:30 is not available
or:
localTime:2025-08-29T13:00:00.000+02:00
that means that the time slot 13:00 - 13:30 is not available
… etc.

  • Use this logic for all outputs from “localTime”
  • The time slots on which you use this logic must never be suggested to the user

that means that, by following the previous example:
2025-08-29T10:00:00.000+02:00 is available
2025-08-29T11:00:00.000+02:00 is available
2025-08-29T15:30:00.000+02:00 is available
…
etc.

You must offer the user only time slots that are available!”

Any idea what I need to change for the results to be consistent and not different each time I test it?

Thank you in advance

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.