@tank/gmail
1.2.0Send, read, search, label, and manage email through the Gmail API. Covers composing (plain text, HTML, attachments), thread-aware replies, Gmail search query syntax (from:, to:, has:attachment, after:), label management, filter automation, and draft workflows. Sources: Gmail API official docs. Triggers: gmail, email, send email, read email, search email, attachment, label, filter, thread, draft, Gmail API, compose, reply, forward, inbox, MIME.
name: "@tank/gmail" description: "Send, read, search, label, and manage email through the Gmail API. Covers composing (plain text, HTML, attachments), thread-aware replies, Gmail search query syntax (from:, to:, has:attachment, after:), label management, filter automation, and draft workflows. Triggers: gmail, email, send email, read email, search email, attachment, label, filter, thread, draft, Gmail API, compose, reply, forward, inbox, MIME."
Gmail
Send, read, search, label, and manage email through the Gmail API.
Overview
This skill teaches AI agents to work with Gmail programmatically — composing and sending emails, reading and searching messages, managing labels and filters, and handling attachments. It supports both simple send operations and complex thread-aware workflows.
Capabilities
Sending Email
- Compose and send plain text or HTML emails
- Add CC, BCC, and reply-to headers
- Attach files from the local filesystem or URLs
- Send replies and forwards within existing threads
- Schedule sends using Gmail's schedule feature
- Create and send from draft
Reading & Searching
- Fetch messages by ID with full or metadata-only views
- Search using Gmail's powerful query syntax (
from:,to:,subject:,has:attachment,after:,before:,label:) - List messages with pagination support
- Fetch full thread conversations
- Parse MIME messages to extract body, attachments, and headers
Organization
- Create, update, and delete labels
- Apply and remove labels from messages
- Batch modify labels across multiple messages
- Create filters for automatic label application
- Archive, trash, and permanently delete messages
- Mark messages as read/unread or starred/unstarred
Drafts
- Create drafts for review before sending
- Update existing draft content
- List and delete drafts
Authentication
Requires Google OAuth 2.0 with one of these scopes:
https://www.googleapis.com/auth/gmail.modify— Read, send, delete, and manage labelshttps://www.googleapis.com/auth/gmail.readonly— Read-only access (for search/read workflows)https://www.googleapis.com/auth/gmail.send— Send-only access
Use the most restrictive scope that fits your use case.
Example Usage
{
"action": "sendEmail",
"to": ["[email protected]"],
"subject": "Deploy complete",
"body": "The v2.1 deployment finished successfully. All health checks passing.",
"format": "plain"
}
{
"action": "searchMessages",
"query": "from:[email protected] after:2026/02/01 has:attachment",
"maxResults": 10
}
Permissions
| Permission | Scope | Reason |
|---|---|---|
| Network | *.googleapis.com | Gmail API calls |
| Network | accounts.google.com | OAuth authentication |
| Filesystem | Read ./** | Read local files for attachments |
| Subprocess | None | Not required |
Best Practices
- Use threads: Always include
threadIdwhen replying to keep conversations organized - Batch operations: Use batch endpoints when modifying multiple messages
- Partial responses: Request only the fields you need with the
fieldsparameter - Respect rate limits: Gmail API has per-user and per-project quotas — implement backoff
- RFC 2822 compliance: When constructing raw messages, ensure proper MIME formatting