New Tool Radar

AI Agents & Automation

How to Give an n8n AI Agent a Gmail Send Tool

Add a Gmail send tool to an n8n AI agent so it can send an email only when asked, with the recipient supplied.

Schematic with three steps: Add a Gmail node as a tool; Write a strict tool description; Test with your own address, then check.

A Gmail node wired as a tool lets an n8n AI agent send email on its own, but a send tool is the most dangerous tool an agent can hold: a wrong address or a misread instruction sends a real message to a real person. Give the agent the tool with a strict description that says it may only send when the user explicitly asks and supplies a recipient, and test it with your own address first.

What you need

  • An n8n workflow with a working AI Agent node and chat model
  • A Gmail credential saved in n8n
  • Your own email address to use as the test recipient

Step 1: Add a Gmail node as a tool on the agent

On the AI Agent node, open the Tool connector and add a Gmail node with the send operation. Leave the recipient, subject and body for the agent to fill from the request.

Step 2: Write a strict tool description

Name the tool send_email and describe it as usable only when the user explicitly asks for an email to be sent and provides a recipient address. Add that it must never guess an address and never send without being asked.

Step 3: Test with your own address, then check the sent folder

Ask the agent to send a test email to your own address, then open the Gmail sent folder and confirm exactly one message went out with the right recipient and subject. If it sent without being asked, or to a guessed address, remove the tool and rewrite the description.

Worked example: synthetic send test

The table below is a synthetic example. It shows the expected result of testing the Gmail tool; no email was sent.

Check Expected Result
Email sent when asked Yes Pass
Recipient is the one supplied Your address Pass
No email sent unasked 0 extra Pass
Subject matches the request Yes Pass

Expected result (UNTESTED). exactly one email goes to the address supplied, only after being asked, with the requested subject. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A send tool can mail a real person on a misread instruction, so never give it a standing instruction to send without being asked.
  • The agent must never guess a recipient address; if none was supplied, it should ask instead of sending.
  • Set access control first if the workflow is shared: anyone who can trigger it can make the agent send mail.

Sources

See all