Google calendar agent is not working

Hi everyone,

I’m building a Calendar Assistant AI and struggling with a classic “AI ignoring the tool output” issue. The goal is simple: ask the AI to delete a specific event.

My Setup:

  • Core: AI Agent node (connected to Google Gemini Chat Model & Simple Memory).

  • Tools: Two Google Calendar nodes configured as tools:

    1. Get many events (to find the eventId).

    2. Delete an event (to perform the action).

The Problem: When I prompt the chat with “Delete today’s TEST event”, the Agent correctly triggers the Get many events tool. I can check the execution logs and see that the tool perfectly retrieved the event (the JSON output contains the exact “TEST” event and its ID).

However, the Agent completely ignores this fetched data. It never triggers the Delete tool. Instead, it either:

  1. Hallucinates and replies: “I couldn’t find any events with that name.”

  2. Simply throws a [No response. Make sure the last executed node outputs the content to display here] error in the chat window.

What I’ve already tried (without success):

  • Set the eventId in the Delete tool to “Defined automatically by the model”.

  • Wrote very strict Tool Descriptions (e.g., “You MUST use Get many events first, grab the ID, and immediately pass it to the Delete tool”).

  • Limited the Get many events output to just 5 items and added a Search Query (also defined by the model) to prevent context window/token overload. The tool only returns 1-2 events max.

  • Switched from OpenAI to Gemini.

It seems like the LLM suffers from “context blindness” and cannot pass the ID from Tool 1 to Tool 2, breaking the chain. Has anyone successfully chained Calendar search → delete using the Agent node? Are there specific instructions or settings I’m missing?

Any help would be greatly appreciated!

1 Like

Hi @Romper Welcome to the community!
This almost always is related to your system prompt and AI prompting, as your AI agent is not correctly and strictly being told what to do exactly and how, consider tighten your AI prompt and system prompt and the issue would be resolved.

hi romper,

sometimes ai can little bit tricky to understand , you should adding more good at prompting when you want to add tools on ai agent itself, here is a little bit prompt might help you with your ai can understand and also use LLM that can understand little bit more like OPENAI 4.1 mini

* Use “Get Events” to fetch calendar schedules when requested.

  • Use “Delete Event” to delete an event. You must use “Get Events” first to get the ID of the event to delete.

    hope this would help you

    let me know if it works or no

hey, this is a known quirk with Gemini and tool chaining — it’s honestly not great at passing outputs between tools compared to OpenAI. Try switching to GPT-4o-mini or even 4.1-mini, they handle multi-step tool calls way better. Also in your system prompt be super explicit like “After getting events, you MUST immediately call delete with the returned eventId, do not respond to the user until deletion is complete.”

@Romper try these specific formats:

For Get many events tool:

Use this tool to search for calendar events. Always use this FIRST when asked to delete an event. This returns event details including the eventId which is required for deletion. Pay close attention to the eventId field in the response.

For Delete an event tool:

Use this tool to delete a calendar event. You MUST first use the "Get many events" tool to find the eventId. Use the exact eventId from the search results. Never guess or make up an eventId.

In your AI Agent node, add a clear system message that reinforces the workflow:

You are a calendar assistant. When asked to delete an event:
1. ALWAYS use the Get many events tool first to find the event
2. Extract the eventId from the results
3. Use the Delete an event tool with that exact eventId
4. Confirm the deletion to the user

Never skip step 1. Never proceed to deletion without a valid eventId from the search results.

Since you’ve tried both OpenAI and Gemini, here are some tips:

  • Gemini: Try using Gemini 1.5 Pro if you’re not already - it generally handles tool chaining better than Flash

  • Consider the temperature setting - lower values (0.1-0.3) make the model more deterministic and better at following instructions

Instead of “Defined automatically by the model” for the eventId in the Delete tool, try:

  • Keep it as “Defined automatically by the model” BUT

  • Add a clear note in the tool description: “The eventId parameter must be extracted from the Get many events tool response”

In your Get many events tool description, add:

After using this tool, look for the 'id' field in each event object. This is the eventId needed for deletion.

Would you like a workflow with any of these solutions?

I finally managed to force the Agent to trigger the “Delete an event” tool! However, I’ve hit a new, frustrating wall. When I ask the Agent to delete an event, the Get many events tool triggers and works perfectly (it finds the real event). But when the Agent calls the Delete tool, it completely ignores the real ID. Instead, it hallucinates a fake placeholder ID (like 1234567890 or even random words) just to fill the required field. Because it sends this fake ID to Google Calendar, I instantly get a 404 Not Found error.

1 Like

The $fromAI() expression for the eventId is your problem here, Gemini just doesn’t reliably pass tool outputs into those expressions. Try removing the $fromAI() from the Delete node and instead use an expression that directly references the output from your Get events node, something like {{ $('Get many events').item.json.id }} — that way you’re forcing it to use the actual returned ID rather than letting the model hallucinate one.

Hi @Romper if your agent is generating random output and is not being accurate there 2 things which you can do, 1st replace the model use Claude models they work in almost all the cases like these, 2nd if the models are continuously failing to fetch the right ID just create a data table of excel that before save event details such as name, ID, date etc although you just need ID but saving all of these would be good for later use and just let the AI have access to the latest events i mean the data table and so just give the AI access to that part only that would really work! And again the same age old advice, tighten the model’s AI prompt and create more examples of scenarios and give EXTRA context for AI to understand your situation correctly.

Yeah that’s exactly what I said earlier — you can’t trust $fromAI() to pass the ID correctly, Gemini especially just makes stuff up. Hardcode the expression to pull from your Get events output like {{ $('Get many events').item.json.id }} instead of letting the model decide. If that still fails honestly just switch to Claude or GPT-4o-mini, they’re way more reliable for chained tool calls.

good point from @achamm on hardcoding the expression — that’s the most reliable fix on the node side.

one more thing that helps on the prompt side: add explicit chaining instructions in your system prompt, something like “when deleting an event, you MUST complete these two steps in order: first call the Get events tool and extract the eventId from the result, then pass that exact eventId to the Delete tool. do not skip step 1 or assume the eventId.”

also worth trying: rename the tools to something sequential like step1_find_event and step2_delete_event. models follow explicit ordering in tool names much more reliably than relying on tool descriptions alone.

1 Like