> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/gmail.md).

# gmail

[Gmail](https://gmail.com/) is Google's popular email service that provides a robust platform for sending, receiving, and managing email communications. With over 1.8 billion active users worldwide, Gmail offers a feature-rich experience with powerful search capabilities, organizational tools, and integration options.

With Gmail, you can:

* **Send and receive emails**: Communicate with contacts through a clean, intuitive interface
* **Organize messages**: Use labels, folders, and filters to keep your inbox organized
* **Search efficiently**: Find specific messages quickly with Google's powerful search technology
* **Automate workflows**: Create filters and rules to automatically process incoming emails
* **Access from anywhere**: Use Gmail across devices with synchronized content and settings
* **Integrate with other services**: Connect with Google Calendar, Drive, and other productivity tools

In Agent Forge, the Gmail integration enables your agents to send, read, and search emails programmatically. This allows for powerful automation scenarios such as sending notifications, processing incoming messages, extracting information from emails, and managing communication workflows. Your agents can compose and send personalized emails, search for specific messages using Gmail's query syntax, and extract content from emails to use in other parts of your workflow. Coming soon, agents will also be able to listen for new emails in real-time, enabling responsive workflows that can trigger actions based on incoming messages. This integration bridges the gap between your AI workflows and email communications, enabling seamless interaction with one of the world's most widely used communication platforms.

### Usage Instructions

Integrate Gmail functionality to send email messages within your workflow. Automate email communications and process email content using OAuth authentication.

### Tools

#### `gmail_send`

Send emails using Gmail

**Input**

| Parameter     | Type   | Required | Description                |
| ------------- | ------ | -------- | -------------------------- |
| `accessToken` | string | Yes      | Access token for Gmail API |
| `to`          | string | Yes      | Recipient email address    |
| `subject`     | string | Yes      | Email subject              |
| `body`        | string | Yes      | Email body content         |

**Output**

| Parameter  | Type   | Description      |
| ---------- | ------ | ---------------- |
| `content`  | string | Response content |
| `metadata` | json   | Email metadata   |

#### `gmail_draft`

Draft emails using Gmail

**Input**

| Parameter     | Type   | Required | Description                |
| ------------- | ------ | -------- | -------------------------- |
| `accessToken` | string | Yes      | Access token for Gmail API |
| `to`          | string | Yes      | Recipient email address    |
| `subject`     | string | Yes      | Email subject              |
| `body`        | string | Yes      | Email body content         |

**Output**

| Parameter  | Type   | Description      |
| ---------- | ------ | ---------------- |
| `content`  | string | Response content |
| `metadata` | json   | Email metadata   |

#### `gmail_read`

Read emails from Gmail

**Input**

| Parameter     | Type    | Required | Description                                                  |
| ------------- | ------- | -------- | ------------------------------------------------------------ |
| `accessToken` | string  | Yes      | Access token for Gmail API                                   |
| `messageId`   | string  | No       | ID of the message to read                                    |
| `folder`      | string  | No       | Folder/label to read emails from                             |
| `unreadOnly`  | boolean | No       | Only retrieve unread messages                                |
| `maxResults`  | number  | No       | Maximum number of messages to retrieve (default: 1, max: 10) |

**Output**

| Parameter  | Type   | Description      |
| ---------- | ------ | ---------------- |
| `content`  | string | Response content |
| `metadata` | json   | Email metadata   |

#### `gmail_search`

Search emails in Gmail

**Input**

| Parameter     | Type   | Required | Description                         |
| ------------- | ------ | -------- | ----------------------------------- |
| `accessToken` | string | Yes      | Access token for Gmail API          |
| `query`       | string | Yes      | Search query for emails             |
| `maxResults`  | number | No       | Maximum number of results to return |

**Output**

| Parameter  | Type   | Description      |
| ---------- | ------ | ---------------- |
| `content`  | string | Response content |
| `metadata` | json   | Email metadata   |

### Notes

* Category: `tools`
* Type: `gmail`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://whitepaper.aitech.io/agentforge/tools/gmail.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
