# Gmail Tools

Packages the Gmail tools you pick for AI Agent nodes.

- Category: AI
- Input: required `input`
- Output: `output`
- Connection: Google connection `id` ULID from `list_connections`

The node performs no Gmail API calls during workflow execution. It emits the chosen `AgentTool`
configs. The AI Agent calls those tools later, using the configured Google OAuth connection and a
fresh Gmail token.

Use the returned `id` for node configuration. The connection `name` is display-only.

## Configuration

- `connection`: the Google connection `id` the tools run through.
- `tools`: the tools to emit, each named after its tool without the `gmail_` prefix, for example
  `["list_emails", "get_email", "create_draft"]`. The list starts empty: pick every tool the agent
  may call. A node needs at least one tool.
- `retry`: whether each Gmail request a tool makes is sent again after a failure that passes, Off
  by default; see [Retries](http_get.md#retries). Reads are sent again freely; sends, replies,
  forwards and draft sends repeat only an attempt Google refused before acting, as on the
  [Gmail node](gmail.md#retry). The `gmail` tool group takes the same setting.

```json
{
  "gmail_tools": {
    "connection": "<Google connection ULID>",
    "tools": ["list_emails", "get_email", "reply_to_email"]
  }
}
```

Nodes saved with the earlier per-tool checkboxes (`list_emails: true`, ...) were rewritten into
this list unchanged in meaning; the old `delete` checkbox became `trash`.
A saved `download_attachment` selection maps to `view_attachment` in both the node and the tool
group.

## The `gmail` tool group

Agents reach the same tools through the `gmail` tool group, requested with `request_tool` and
configured with a Google connection. The group has one switch per tool, named as in `tools`
above, and every switch is on unless turned off; switches added later are on in every existing
entry too. A group configuration saved with the switch `delete` reads it as `trash`. A group
with no connection picked is not ready to build tools.

## Google OAuth and Send-As Requirements

- Sending with `gmail_send_email`, `gmail_reply_to_email`, `gmail_forward_email` or
  `gmail_send_draft` requires `gmail.send` or `gmail.modify`.
- Replying and forwarding also read the original: `gmail.readonly` plus `gmail.send`, or
  `gmail.modify`.
- Labels, drafts, trash and restore need `gmail.modify`.
- Listing or validating Gmail send-as aliases requires `gmail.settings.basic`.
- A call whose scope the connection lacks fails with Google's insufficient-permission error;
  reconnect the account to grant it.

## Send-As Aliases

To send from an address other than the authenticated Gmail account, configure that address in
Gmail or Google Workspace as a **Send mail as** alias first.

- The alias must be verified or accepted in Gmail/Google Workspace before Verdalia can send with it.
- Verdalia does not create, verify, or accept send-as aliases.
- Send, reply, forward and draft tools use `from_email` for the sender address and `from_name`
  for its display name.
- If `from_email` is empty, Gmail sends from the authenticated account default address.

## Tool names

Every emitted tool is called `<handle>__<tool>`, where `<handle>` is the fixed handle of the
configured Google connection, for example `google_freja__gmail_list_emails`. The prefix is there
even when the workspace has a single Google connection. Renaming the connection never changes it.
A name longer than 64 characters keeps its first 55 characters and ends with `_` and an
8-character hash. The names below are the `<tool>` part.

## Tools

Listing tools return 10 results unless `max_results` says otherwise.

Read:

- `gmail_list_emails`, `gmail_get_email`
- `gmail_list_threads`, `gmail_get_thread`
- `gmail_list_drafts`, `gmail_get_draft`
- [`gmail_view_attachment`](/docs/tools/GmailViewAttachmentTool)
- `gmail_list_labels`

`gmail_get_email`, `gmail_get_thread` and `gmail_get_draft` return message headers, `text` (plain
text first, otherwise HTML converted to Markdown) and `attachments` for each message. Thread
messages share a 100,000-character body text limit. The attachment list includes files inside
forwarded messages. Each reference gives `attachment_id`, `filename`, `content_type`,
`size_bytes` when known, and `inline` for inline files. Give the viewer the containing message's
`id` as `email_id`, even when reading from a thread or draft, and the listed `attachment_id`.

Write:

- `gmail_create_draft`, `gmail_update_draft`
- `gmail_modify_labels`, `gmail_mark_read` (`read: false` marks unread), `gmail_archive`
- `gmail_untrash`
- `gmail_create_label`, `gmail_update_label`

Send:

- `gmail_send_email`, `gmail_reply_to_email`, `gmail_forward_email`, `gmail_send_draft`

Delete:

- `gmail_trash` (moves a message to the trash; `gmail_untrash` restores it)
- `gmail_delete_draft`, `gmail_delete_label`

Under the default meter, send and destructive tools ask before they run. For business-process side
effects, prefer a subworkflow tool unless the workflow deliberately grants the direct Gmail tool.

## Reply to Email

`gmail_reply_to_email` requires `email_id`; `body_text`, `body_html`, `from_email`, `from_name`
and `attachments` are optional. Use the Gmail message `id` from list/get or trigger `message_id`,
not a thread id or RFC Message-ID.

The tool sends to the original Reply-To addresses, or From if Reply-To is absent, retaining
the original subject and thread. It does not reply-all, quote the original, add a signature,
or mark the original read. This recipient rule also applies to your own sent messages.
It accepts no recipient, subject, thread or raw-header overrides.

`gmail_create_draft` with `reply_to_email_id` drafts such a reply instead of sending it; leave
`to` and `subject` empty then.

Choose `reply_to_email` on `gmail_tools`, or leave its switch on in the Gmail tool group.
The workflow tool envelope is `{"GmailReplyToEmailTool":{"connection":"<Google connection ULID>","handle":"<connection handle>"}}`.
The tool node fills in `handle`; a hand-written envelope without it is refused, because the tool
would reach the model without its connection prefix.
Gmail tools are General and can run in agents, MCP, workflow AI nodes, or General agent
runtimes when explicitly configured. The connection-bound Gmail group is not a new choice in
the generic Tool Provider's curated group picker; use Gmail Tools for workflow setup. This is
picker curation, not a different execution surface.

The raw result is Gmail's sent message. The bounded summary identifies the original target and
the sent message and thread with state `sent`, without message bodies or raw MIME.
Missing/unsafe parent metadata prevents sending; a send failure is not retried automatically.
