
gmail-automation
Automate Gmail tasks via Rube MCP (Composio): send/reply, search, labels, drafts, attachments. Always search tools first for current schemas.
- Installs
- 173
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/composiohq/awesome-claude-skills --skill gmail-automation- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads gmail-automation automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Gmail Automation via Rube MCP
Automate Gmail operations through Composio's Gmail toolkit via Rube MCP.
Toolkit docs: composio.dev/toolkits/gmail
Prerequisites
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Gmail connection via
RUBE_MANAGE_CONNECTIONSwith toolkitgmail - Always call
RUBE_SEARCH_TOOLSfirst to get current tool schemas
Setup
Get Rube MCP: Add https://rube.app/mcp as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
- Verify Rube MCP is available by confirming
RUBE_SEARCH_TOOLSresponds - Call
RUBE_MANAGE_CONNECTIONSwith toolkitgmail - If connection is not ACTIVE, follow the returned auth link to complete Google OAuth
- Confirm connection status shows ACTIVE before running any workflows
Core Workflows
1. Send an Email
When to use: User wants to compose and send a new email
Tool sequence:
GMAIL_SEARCH_PEOPLE- Resolve contact name to email address [Optional]GMAIL_SEND_EMAIL- Send the email [Required]
Key parameters:
recipient_email: Email address or 'me' for selfsubject: Email subject linebody: Email content (plain text or HTML)is_html: Must betrueif body contains HTML markupcc/bcc: Arrays of email addressesattachment: Object with{s3key, mimetype, name}from prior download
Pitfalls:
- At least one of
recipient_email,cc, orbccrequired - At least one of
subjectorbodyrequired - Attachment
mimetypeMUST contain '/' (e.g., 'application/pdf', not 'pdf') - Total message size limit ~25MB after base64 encoding
- Use
from_emailonly for verified aliases in Gmail 'Send mail as' settings
2. Reply to a Thread
When to use: User wants to reply to an existing email conversation
Tool sequence:
GMAIL_FETCH_EMAILS- Find the email/thread to reply to [Prerequisite]GMAIL_REPLY_TO_THREAD- Send reply within the thread [Required]
Key parameters:
thread_id: Hex string from FETCH_EMAILS (e.g., '169eefc8138e68ca')message_body: Reply contentrecipient_email: Reply recipientis_html: Settruefor HTML content
Pitfalls:
thread_idmust be hex string; prefixes like 'msg-f:' are auto-stripped- Legacy Gmail web UI IDs (e.g., 'FMfcgz...') are NOT supported
- Subject is inherited from original thread; setting it creates a new thread instead
- Do NOT include subject parameter to stay within thread
3. Search and Filter Emails
When to use: User wants to find specific emails by sender, subject, date, label, etc.
Tool sequence:
GMAIL_FETCH_EMAILS- Search with Gmail query syntax [Required]GMAIL_FETCH_MESSAGE_BY_MESSAGE_ID- Get full message details for selected results [Optional]
Key parameters:
query: Gmail search syntax (from:, to:, subject:, is:unread, has:attachment, after:YYYY/MM/DD, before:YYYY/MM/DD)max_results: 1-500 messages per pagelabel_ids: System IDs like 'INBOX', 'UNREAD'include_payload: Settrueto get full message contentids_only: Settruefor just message IDspage_token: For pagination (fromnextPageToken)
Pitfalls:
- Returns max ~500 per page; follow
nextPageTokenviapage_tokenuntil absent resultSizeEstimateis approximate, not exact count- Use 'is:' for states (is:unread, is:snoozed, is:starred)
- Use 'label:' ONLY for user-created labels
- Common mistake: 'label:snoozed' is WRONG — use 'is:snoozed'
include_payload=trueon broad searches creates huge responses; default to metadata- Custom labels require label ID (e.g., 'Label_123'), NOT label name
4. Manage Labels
When to use: User wants to create, modify, or organize labels
Tool sequence:
GMAIL_LIST_LABELS- List all labels to find IDs and detect conflicts [Required]GMAIL_CREATE_LABEL- Create a new label [Optional]GMAIL_PATCH_LABEL- Rename or change label colors/visibility [Optional]GMAIL_DELETE_LABEL- Delete a user-created label (irreversible) [Optional]
Key parameters:
label_name: Max 225 chars, no commas, '/' for nesting (e.g., 'Work/Projects')background_color/text_color: Hex values from Gmail's predefined paletteid: Label ID for PATCH/DELETE operations
Pitfalls:
- 400/409 error if name is blank, duplicate, or reserved (INBOX, SPAM, CATEGORY_*)
- Color specs must use Gmail's predefined palette of 102 hex values
- DELETE is permanent and removes label from all messages
- Cannot delete system labels (INBOX, SENT, DRAFT, etc.)
5. Apply/Remove Labels on Messages
When to use: User wants to label, archive, or mark emails as read/unread
Tool sequence:
GMAIL_LIST_LABELS- Get label IDs for custom labels [Prerequisite]GMAIL_FETCH_EMAILS- Find target messages [Prerequisite]GMAIL_BATCH_MODIFY_MESSAGES- Bulk add/remove labels (up to 1000 messages) [Required]GMAIL_ADD_LABEL_TO_EMAIL- Single-message label changes [Fallback]
Key parameters:
messageIds: Array of message IDs (max 1000)addLabelIds: Array of label IDs to addremoveLabelIds: Array of label IDs to removemessage_id: 15-16 char hex string for single operations
Pitfalls:
- Max 1000 messageIds per BATCH call; chunk larger sets
- Use 'CATEGORY_UPDATES' not 'UPDATES'; full prefix required for category labels
- SENT, DRAFT, CHAT are immutable — cannot be added/removed
- To mark as read: REMOVE 'UNREAD'. To archive: REMOVE 'INBOX'
message_idmust be 15-16 char hex, NOT UUIDs or web UI IDs
6. Handle Drafts and Attachments
When to use: User wants to create, edit, or send email drafts, possibly with attachments
Tool sequence:
GMAIL_CREATE_EMAIL_DRAFT- Create a new draft [Required]GMAIL_UPDATE_DRAFT- Edit draft content [Optional]GMAIL_LIST_DRAFTS- List existing drafts [Optional]GMAIL_SEND_DRAFT- Send a draft (requires explicit user approval) [Optional]GMAIL_GET_ATTACHMENT- Download attachment from existing message [Optional]
Key parameters:
recipient_email: Draft recipientsubject: Draft subject (omit for reply drafts to stay in thread)body: Draft contentis_html: Settruefor HTML contentattachment: Object with{s3key, mimetype, name}thread_id: For reply drafts (leave subject empty to stay in thread)
Pitfalls:
- Response includes
data.id(draft_id) ANDdata.message.id; usedata.idfor draft operations - Setting subject on a thread reply draft creates a NEW thread instead
- Attachment capped at ~25MB; base64 overhead can push near-limit files over
- UPDATE_DRAFT replaces entire content, not patches; include all fields you want to keep
- HTTP 429 on bulk draft creation; use exponential backoff
Common Patterns
ID Resolution
Label name → Label ID:
1. Call GMAIL_LIST_LABELS
2. Find label by name in response
3. Extract id field (e.g., 'Label_123')
Contact name → Email:
1. Call GMAIL_SEARCH_PEOPLE with query=contact_name
2. Extract emailAddresses from response
Thread ID from search:
1. Call GMAIL_FETCH_EMAILS or GMAIL_LIST_THREADS
2. Extract threadId (15-16 char hex string)
Pagination
- Set
max_resultsup to 500 per page - Check response for
nextPageToken - Pass token as
page_tokenin next request - Continue until
nextPageTokenis absent or empty string resultSizeEstimateis approximate, not exact
Gmail Query Syntax
Operators:
from:sender@example.com- Emails from senderto:recipient@example.com- Emails to recipientsubject:"exact phrase"- Subject contains exact phraseis:unread- Unread messagesis:starred- Starred messagesis:snoozed- Snoozed messageshas:attachment- Has attachmentsafter:2024/01/01- After date (YYYY/MM/DD)before:2024/12/31- Before datelabel:custom_label- User-created label (use label ID)in:sent- In sent foldercategory:primary- Primary category
Combinators:
AND- Both conditions (default)OR- Either conditionNOT- Exclude condition()- Group conditions
Examples:
from:boss@company.com is:unread- Unread emails from bosssubject:invoice has:attachment after:2024/01/01- Invoices with attachments this year(from:alice OR from:bob) is:starred- Starred emails from Alice or Bob
Known Pitfalls
ID Formats:
- Custom label operations require label IDs (e.g., 'Label_123'), not display names
- Always call LIST_LABELS first to resolve names to IDs
- Message IDs are 15-16 char hex strings
- Do NOT use UUIDs, web UI IDs, or 'thread-f:' prefixes
Query Syntax:
- Use 'is:' for states (unread, snoozed, starred)
- Use 'label:' ONLY for user-created labels
- System labels use 'is:' or 'in:' (e.g., 'is:sent', 'in:inbox')
Rate Limits:
- BATCH_MODIFY_MESSAGES max 1000 messages per call
- Heavy use triggers 403/429 rate limits
- Implement exponential backoff for bulk operations
Response Parsing:
- Response data may be nested under
data_previewordata.messages - Parse defensively with fallbacks
- Timestamp
messageTimestampuses RFC3339 with 'Z' suffix - Normalize to '+00:00' for parsing if needed
Attachments:
- Attachment
s3keyfrom prior download may expire - Use promptly after retrieval
- Mimetype must include '/' separator
Quick Reference
| Task | Tool Slug | Key Params |
|---|---|---|
| Send email | GMAIL_SEND_EMAIL | recipient_email, subject, body, is_html |
| Reply to thread | GMAIL_REPLY_TO_THREAD | thread_id, message_body, recipient_email |
| Search emails | GMAIL_FETCH_EMAILS | query, max_results, label_ids, page_token |
| Get message details | GMAIL_FETCH_MESSAGE_BY_MESSAGE_ID | message_id |
| List labels | GMAIL_LIST_LABELS | (none) |
| Create label | GMAIL_CREATE_LABEL | label_name, background_color, text_color |
| Modify labels bulk | GMAIL_BATCH_MODIFY_MESSAGES | messageIds, addLabelIds, removeLabelIds |
| Create draft | GMAIL_CREATE_EMAIL_DRAFT | recipient_email, subject, body, thread_id |
| Send draft | GMAIL_SEND_DRAFT | draft_id |
| Get attachment | GMAIL_GET_ATTACHMENT | message_id, attachment_id |
| Search contacts | GMAIL_SEARCH_PEOPLE | query |
| Get profile | GMAIL_GET_PROFILE | (none) |
Powered by Composio
FAQ
What does the gmail-automation skill do?
Automate Gmail tasks via Rube MCP (Composio): send/reply, search, labels, drafts, attachments. Always search tools first for current schemas.
How do I install gmail-automation?
Run npx skills add https://github.com/composiohq/awesome-claude-skills --skill gmail-automation in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/gmail-automation/ (personal) or .claude/skills/gmail-automation/ (project).
Which AI agents can use gmail-automation?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is gmail-automation safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains gmail-automation?
It is published by composiohq in composiohq/awesome-claude-skills. It has 173 recorded installs.
More from composiohq/awesome-claude-skills
tailored-resume-generator
composiohq/awesome-claude-skills
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
content-research-writer
composiohq/awesome-claude-skills
Assists in writing high-quality content by conducting research, adding citations, improving hooks, iterating on outlines, and providing real-time feedback on each section. Transforms your writing process from solo effort to collaborative partnership.
changelog-generator
composiohq/awesome-claude-skills
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
file-organizer
composiohq/awesome-claude-skills
Intelligently organizes your files and folders across your computer by understanding context, finding duplicates, suggesting better structures, and automating cleanup tasks. Reduces cognitive load and keeps your digital workspace tidy without manual effort.
youtube-downloader
composiohq/awesome-claude-skills
Download YouTube videos with customizable quality and format options. Use this skill when the user asks to download, save, or grab YouTube videos. Supports various quality settings (best, 1080p, 720p, 480p, 360p), multiple formats (mp4, webm, mkv), and audio-only downloads as MP3.
competitive-ads-extractor
composiohq/awesome-claude-skills
Extracts and analyzes competitors' ads from ad libraries (Facebook, LinkedIn, etc.) to understand what messaging, problems, and creative approaches are working. Helps inspire and improve your own ad campaigns.
Popular productivity & automation skills
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.
lark-doc
open.feishu.cn
飞书云文档(Docx / Wiki)内容操作:读取、创建、编辑文档,插入或下载图片附件,以及操作思维笔记。用户提供文档 URL/token(包括 doubao.com 的 /docx/、/wiki/)时使用;按 URL 路径/token 而非域名路由;/page/ 是妙搭应用,非飞书云文档。文档内嵌资源按读取参考中的统一规则分流。独立评论操作走 lark-drive;随正文读取评论使用 docs +fetch。表格或 Base 内部数据操作不在本 skill。
lark-base
open.feishu.cn
飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。
lark-drive
open.feishu.cn
飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。
lark-shared
open.feishu.cn
Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling notice JSON.
lark-im
open.feishu.cn
飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。