Gmail tools random actions

Describe the problem/error/question

I have a workflow that aims to do all the operation related to Gmail; being sending, drafting, deleting, etc. I am using gpt 4.1nano. I see the following issues which I cannot see why they occurs:

  1. if I ask to draft an email, it would would draft BUT it would also sent it to myself.
  2. If i ask to send an email to someone. it did BUT it would also send it to myself (i guess it has my email address in memory from previous tests).
  3. I have asked to send a dinner invitation email, all the query had passed correctly, but the email the model decided to send was on the very random topic! this one I guess the model is to be blamed for. right?
  4. in one occasion it randomly replied an email to myself which was not what I had asked.
    The workflow gets the user prompt via telegram from another workflow. here is the input:
    [

{
“text”:
“Draft an email to [email protected] to cancel our meeting today at 4:00 pm”,
“to”:
[email protected]”,

“subject”:
“Cancellation of today’s meeting at 4:00 PM”,

“body”:
“Hi Sali,\n\nII have to cancel our meeting scheduled for today at 4:00 PM. Please let me know your availability so we can reschedule at a convenient time..\n\nsincerely Sali”,

“toolCallId”:
“call_P6FUQeaR4rFDOEpKW2T2TxQF”

}
]

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Version 2.6.3
  • Database (default: SQLite):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: mac
1 Like

Hi @Salime_Dashti!

This problem is almost always occurs because of Bad System Prompt and Not using a suitable model.

For your use case i recommend using Claude Models i would recommend the latest one and consider using models based on this:

And Also please consider tighten the System Prompt and explicitly mention the tool usage and cases so that it matches to your desired outcome.

Thanks for the reply.

The problem is still insist.

The main issue now is that when asked to send email, it sends it also to myself.

Here is my AI agent prompt:

time

  • date and time: [DateTime: 2026-02-19T12:42:16.097+01:00]

role

You are my email assistant. Help me manage my emails using Gmail tools, listed below, with the following details:

Recipient(s): [Insert recipient names and/or email addresses] Subject: [Insert email subject] Message Body: [Provide the main message you’d like to convey. Be clear and specific.] Tone: [e.g., formal, informal, friendly, assertive, apologetic] Attachments (optional): [List any files to attach, if any] CC/BCC (optional): [List any secondary recipients]

Mandatory instruction to follow

  1. ALWAYS call the relevant “Tool” for EVERY query, without exception.

  2. NEVER answer from memory, prior conversations, or general knowledge.

  3. If Tool returns no results, respond EXACTLY: “Sorry, I couldn’t find any relevant information to answer that.”

  4. The name at the end of the email, after the closing, is always “Sali”.

  5. when sending, drafting, or replying to an email, use ONLY the recipient(s) explicitly stated in the user’s request. Do not add, infer, or substitute any other email addresses.

TOOLS

  • getEmails
    Use this tool to retrieve unread emails. the keywords for this action includes, but not limited to: get my emails, read my emails etc

  • sendEmail
    se this tool to immediately send an email. Keywords: send an email, email someone, write an email to, write to. NEVER use Draftemail when the user says ‘send’. If the user says ‘send’, ALWAYS use sendEmail directly

  • Draftemail
    Use this tool to create a draft of an email and save it as a draft in my email. the keywords for this action includes, but not limited to: draft an email, prepare an email, etc.

  • saveReplyDraft
    Use this tool to save a draft for an email reply. You must first use “getEmails” to retrieve the thread ID of the email you need to reply to with a draft.

  • sendReply
    Use this tool to send an email reply. You must first use “getEmails” to retrieve the message ID of the email you want to reply to.

  • getLabels
    Use this tool to retrieve available labels.

  • labelEmails
    Use this tool to label an email. First, use “getEmails” to get the message ID of the email you want to label. Then, use “getLabels” to obtain the label ID.

  • markRead
    Use this tool to mark an email as read. You must first use “getEmails” to get the message ID of the email to be marked.

  • markUnread
    Use this tool to mark an email as unread. You must first use “getEmails” to get the message ID of the email you want to mark as unread.

Examples “Send an email to…” → Use the sendEmail tool
“Reply to this email with a draft…” → Use the saveReplyDraft tool “draft an email …” → use Draftemail tool.

The other change that I have made is: instead of having the AI decide who are the recipients I said one : {{ json.to)) and also {{ $(‘When Executed by Another Workflow’).item.json.to }}. None worked.

Would you please advise me here?

Thanks in advanced,

Cheers.

hey,salime

in your ai agent itself, have u add tool call name ‘Think’?, it useful when your ai agent getting stuck , and also make sure your tools name has to be adding some space, it also can make the ai agent confused. and also the 4 section (mandotory instruction you can just simply type ‘ Always sign off as ‘Sali’, do not make overcomplicated. sometimes that makes AI a bit off

may this help

Thanks for the response. I have tried the space and the simplification of the prompt. not changed.

@Salime_Dashti Consider defining more about how you want it to behave in certain tasks, also your prompt is really fine the problem here might be the model, have you tried using good models like Claude and GPTs? Cause now the problem does not seems to be like a prompting issue, consider using a strong model and choose a model with this:

Switching to a smarter and more capable model would be a better take. Do not consider Gemini models i have tried using them they are not good with tool callings and Agentic AI.

okay i see you still have that problem can you try make new ai agent and paste the prompt again
cus sometimes also i got stuck even the prompt correctly

hope this would be work