Gmail
Multi-action Gmail skill for agents — list/read/search messages, compose one as a draft (never sends; the owner sends it), manage labels (add/remove/list)…
by stevehuang0115★ 95 GitHub stars
Install Gmail in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Gmail (multi-action, v1.2.0)
Multi-action Gmail skill that lets agents manage messages and labels on behalf
of a connected Google account. The account is selected at execution time via
the gmail credential slot, so the same skill can be reused across multiple
Google accounts (e.g., work vs personal).
Note: a separate
gmail-readerskill (read-only, plain-text output) is kept for the orchestrator'scredential-manager read-gmailaction. This skill is the structured-JSON, full-feature version intended for direct agent use.
Why a single gmail.modify scope?
gmail.modify is a Google-side functional superset that covers gmail.readonly,
gmail.send, and label/state mutations. The Crewly skill executor performs
string-exact scope matching (no superset awareness), so declaring the
single most-capable scope keeps the requirement check simple and lets all 9
actions share one OAuth grant.
Usage
Run via crewly_execute_skill with credentialBindings.gmail set to the
credential UUID of the Google account to use. Pass a JSON object on argv[1]
specifying the action and its parameters.
# Direct invocation (env vars must be set by the executor)
bash execute.sh '{"action":"list","q":"is:unread in:inbox","maxResults":10}'
bash execute.sh '{"action":"read","id":"18fa7b..."}'
bash execute.sh '{"action":"search","q":"from:[email protected]","maxResults":5}'
bash execute.sh '{"action":"send","to":"[email protected]","subject":"Hello","body":"Hi there."}'
bash execute.sh '{"action":"list-labels"}'
bash execute.sh '{"action":"add-label","id":"18fa...","labelId":"Label_5"}'
bash execute.sh '{"action":"remove-label","id":"18fa...","labelId":"Label_5"}'
bash execute.sh '{"action":"mark-as-read","id":"18fa..."}'
bash execute.sh '{"action":"mark-as-unread","id":"18fa..."}'
Actions
Email operations
list / search
List messages matching a Gmail search query. search is an alias for
list (shares code).
Input:
{"action":"list", "q":"is:unread in:inbox", "maxResults":10}
q(optional) — Gmail search query. Defaults tois:unread in:inbox.maxResults(optional) — Number of messages to return. Clamped 1..50, default 10.
Output:
{
"success": true,
"account": "[email protected]",
"query": "is:unread in:inbox",
"count": 3,
"messages": [
{"id":"18f...", "threadId":"18e...", "subject":"...", "from":"...", "date":"...", "snippet":"..."}
]
}
read
Fetch a single message by ID and return decoded headers + body.
Input:
{"action":"read", "id":"18fa7b..."}
id(required) — Gmail message id (from alistresult).
Output:
{
"success": true,
"id": "18fa7b...",
"threadId": "...",
"labelIds": ["INBOX","UNREAD"],
"headers": {"from":"...", "to":"...", "cc":"...", "subject":"...", "date":"..."},
"body": "decoded plain text body",
"bodyHtml": "<...> (only if no text/plain part exists)",
"snippet": "..."
}
The body extraction walks payload.parts[] recursively and prefers
text/plain. If only text/html is available, the HTML is returned as
bodyHtml and a tag-stripped plaintext fallback is placed in body.
send
Compose a new email in the bound Google account as a draft. Nothing is
sent: the message lands in the account's Drafts folder and only the owner
sends it (crewly#894 — the same rule as gmail-send, #999). Tell the owner
the draft is there; do not look for a way to send it yourself.
Input:
{"action":"send", "to":"[email protected]", "subject":"Hello", "body":"Plain text.", "cc":"[email protected]", "bcc":"[email protected]"}
to(required) — Recipient address. Comma-separated list allowed.subject(required) — Subject line.body(required) — Plain-text body.cc,bcc(optional) — CC / BCC recipients.
Output:
{"success": true, "draft": true, "id": "r123...", "messageId": "18fa...", "threadId": "...", "note": "Saved as a draft in the account's Drafts folder; only the owner sends it."}
id is the draft id; messageId / threadId are the draft's message.
Label management
list-labels
List all labels on the account (system + user-defined). Call this before
add-label to discover valid label IDs.
Input:
{"action":"list-labels"}
Output:
{
"success": true,
"account": "[email protected]",
"count": 12,
"labels": [
{"id":"INBOX", "name":"INBOX", "type":"system"},
{"id":"UNREAD", "name":"UNREAD", "type":"system"},
{"id":"Label_5", "name":"Work", "type":"user"}
]
}
add-label / remove-label
Add or remove one or more labels on a message.
Input:
{"action":"add-label", "id":"18fa7b...", "labelId":"Label_5"}
{"action":"remove-label", "id":"18fa7b...", "labelIds":["Label_5","Label_7"]}
id(required) — Gmail message id.labelId(string) ORlabelIds(array) (required, at least one) — Label IDs to add/remove. The script accepts either form.
Output: ``
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- execute.live.test.sh
- execute.sh
- execute.test.sh
- instructions.md
- mock-gmail-server.py
- skill.json
FAQ
What does the Gmail skill do?
Multi-action Gmail skill for agents — list/read/search messages, compose one as a draft (never sends; the owner sends it), manage labels (add/remove/list), and toggle read/unread. Requires a google-oauth credential bound to the 'gmail' slot with gmail.modify scope.
How do I install the Gmail skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the Gmail skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
agent-skill-stack
GitHubFind, evaluate, and assemble the smallest compatible set of AI Agent Skills for an end-to-end natural-language goal. Use when a user wants Skills for a…
build-evidence-map
GitHubBuild an auditable evidence map for a contested technical choice, research synthesis, proposal review, or consequential decision. Use when Copilot must…
pinecone-rag
GitHubBuild production RAG pipelines and persistent agent memory using Pinecone as the vector database backend. ALWAYS USE THIS SKILL when the user mentions…
qdrant-monitoring-debugging
GitHubDiagnoses Qdrant production issues using metrics and observability tools. Use when someone reports 'optimizer stuck', 'indexing too slow', 'memory too high'…