Gmail search

From stevehuang0115/crewly · View interactive version

Gmail search is an AI agent skill from the GitHub repository stevehuang0115/crewly. Search the owner's Gmail (via the Google Workspace grant held by Crewly Cloud) and list matching messages with sender, subject, date and snippet. Read-only.

How to use this skill

Skill file

Gmail Search

Runs a Gmail search on the owner's mailbox and prints the hits. Uses the

Google Workspace connection the owner made in Crewly;

the mail content goes straight from Google to this instance.

bash execute.sh --query "is:unread from:ann@example.com newer_than:2d" --max 10
bash execute.sh '{"query":"subject:invoice has:attachment","max":5}'

Parameters

| Name | Required | Meaning |

|---|---|---|

| --query / -q (query) | yes | Gmail search syntax (from:, subject:, is:unread, newer_than:7d, has:attachment, …) |

| --max / -n (max) | no | Result cap, default 20, max 100 |

Output

{"query":"is:unread","count":2,"messages":[{"id":"18f…","threadId":"18f…","from":"Ann <ann@example.com>","to":"owner@example.com","subject":"Q3 numbers","date":"Thu, 18 Sep 2026 10:00:00 +0000","snippet":"Here are the…"}]}

Use the id with gmail-read to get the body; threadId + gmail-read's

messageId with gmail-send to reply in-thread.

Failures

{"success":false,"reason":"not_connected","hint":"<connect URL>"} — the

owner has not connected Google Workspace yet; run the google-connect skill so

they get a one-tap card in Slack (manual fallback: https://crewlyai.com/portal/integrations/google; never

Crewly settings or the Connections page). Exit code 1.

Choosing a Google account

Several Google accounts can be connected at once. Without --account the call uses the default one (the first you connected, or whichever the owner marked default). Name one explicitly when it matters:

bash execute.sh --account work@company.com ...

The account must be connected for this product — Google consent is per product (Gmail / Calendar / Drive), so an account connected only for Calendar cannot read Drive.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.