Gmail
Description: Enable agents to send, read, and manage emails in Gmail.
Author: Arcade
Code: GitHub
Auth: User authorization via the Google auth provider
The Arcade Gmail toolkit provides a pre-built set of tools for interacting with Gmail. These tools make it easy to build agents and AI apps that can:
- Send, read, and manage emails
- Compose and update draft emails
- Delete emails
- Search for emails by header
- List emails in the user’s mailbox
Install
pip install arcade_google
Available Tools
These tools are currently available in the Arcade GitHub toolkit.
Tool Name | Description |
---|---|
SendEmail | Send an email using the Gmail API. |
SendDraftEmail | Send a draft email using the Gmail API. |
WriteDraftEmail | Compose a new email draft using the Gmail API. |
UpdateDraftEmail | Update an existing email draft. |
DeleteDraftEmail | Delete a draft email using the Gmail API. |
TrashEmail | Move an email to the trash folder. |
ListDraftEmails | List draft emails in the user's mailbox. |
ListEmailsByHeader | Search for emails by header using the Gmail API. |
ListEmails | Read emails and extract plain text content. |
SearchThreads | Search for threads in the user's mailbox. |
ListThreads | List threads in the user's mailbox. |
GetThread | Get the specified thread by ID. |
If you need to perform an action that’s not listed here, you can get in touch with us to request a new tool, or create your own tools with the Google auth provider.
SendEmail
Send an email using the Gmail API.
Parameters
subject
(string, required) The subject of the email.body
(string, required) The body of the email.recipient
(string, required) The recipient of the email.cc
(array, optional, Defaults to None) CC recipients of the email.bcc
(array, optional, Defaults to None) BCC recipients of the email.
SendDraftEmail
Send a draft email using the Gmail API.
Parameters
email_id
(string, required) The ID of the draft to send.
WriteDraftEmail
Compose a new email draft using the Gmail API.
Parameters
subject
(string, required) The subject of the draft email.body
(string, required) The body of the draft email.recipient
(string, required) The recipient of the draft email.cc
(array, optional, Defaults to None) CC recipients of the draft email.bcc
(array, optional, Defaults to None) BCC recipients of the draft email.
UpdateDraftEmail
Update an existing email draft.
Parameters
draft_email_id
(string, required) The ID of the draft email to update.subject
(string, required) The subject of the draft email.body
(string, required) The body of the draft email.recipient
(string, required) The recipient of the draft email.cc
(array, optional, Defaults to None) CC recipients of the draft email.bcc
(array, optional, Defaults to None) BCC recipients of the draft email.
DeleteDraftEmail
Delete a draft email using the Gmail API.
Parameters
draft_email_id
(string, required) The ID of the draft email to delete.
TrashEmail
Move an email to the trash folder.
Parameters
email_id
(string, required) The ID of the email to trash.
ListDraftEmails
List draft emails in the user’s mailbox.
Parameters
n_drafts
(integer, optional, Defaults to 5) Number of draft emails to read.
ListEmailsByHeader
Search for emails by header using the Gmail API.
At least one of the following parameters must be provided: sender
, recipient
, subject
, body
.
Parameters
sender
(string, optional, Defaults to None) The name or email address of the sender.recipient
(string, optional, Defaults to None) The name or email address of the recipient.subject
(string, optional, Defaults to None) Words to find in the subject of the email.body
(string, optional, Defaults to None) Words to find in the body of the email.date_range
(string, optional, Defaults to None) The date range of the emails.limit
(integer, optional, Defaults to 25) The maximum number of emails to return.
ListEmails
Read emails from a Gmail account and extract plain text content.
Parameters
n_emails
(integer, optional, Defaults to 5) Number of emails to read.
SearchThreads
Search for threads in the user’s mailbox
Parameters
page_token
(string, optional) Page token to retrieve a specific page of results in the list.max_results
(integer, optional, Defaults to10
) The maximum number of threads to return.include_spam_trash
(boolean, optional) Whether to include spam and trash in the results.label_ids
(array, optional) The IDs of labels to filter by.sender
(string, optional) The name or email address of the sender of the email.recipient
(string, optional) The name or email address of the recipient.subject
(string, optional) Words to find in the subject of the email.body
(string, optional) Words to find in the body of the email.date_range
(string, optional) The date range of the email. Valid values are ‘today’, ‘yesterday’, ‘last_7_days’, ‘last_30_days’, ‘this_month’, ‘last_month’, ‘this_year’.
ListThreads
List threads in the user’s mailbox.
Parameters
page_token
(string, optional) Page token to retrieve a specific page of results in the list.max_results
(integer, optional, Defaults to10
) The maximum number of threads to return.include_spam_trash
(boolean, optional) Whether to include spam and trash in the results.
GetThread
Get the specified thread by ID.
Parameters
thread_id
(string, required) The ID of the thread to retrieve.
Auth
The Arcade Gmail toolkit uses the Google auth provider to connect to users’ Google accounts.
With the hosted Arcade Engine, there’s nothing to configure. Your users will see Arcade (demo)
as the name of the application that’s requesting permission.
The hosted Arcade Engine is intended for demo and testing purposes only, not for production use. To use Arcade and Google Calendar in production, you must use a self-hosted instance of the Arcade Engine.
With a self-hosted installation of Arcade, you need to configure the Google auth provider with your own Google app credentials.