Search Gmail
TL;DR
About
Any operator the Gmail search box understands works here, because the query runs in your own signed-in Gmail, and each match comes back with a threadId the other Gmail scripts accept. Say a bookkeeper closing September runs has:attachment filename:pdf subject:(invoice OR receipt) after:2026/09/01 before:2026/10/01 with limit set to 50. She gets 34 threads, comfortably under the cap, hands each threadId to download_attachment and drops the PDFs into the accounting tool, binning the inline logos that come along. Each result is a thread, and only the first results page is read: 20 rows by default, 50 at most. On personal accounts Gmail's default sort for search is Most relevant, so those rows are the top of a ranking, not necessarily the newest matches. The date field is Gmail's tooltip text in your account language, so parse it before sorting. On a long back-and-forth, sender is whoever is listed first on the row, often not the last person to reply.
Input
query requiredGmail search query; full native operator syntax (from:, subject:, has:attachment, after:...).
limit optionalMax rows to return (1-50, default 20).
account optionalGmail account address to act as (authuser pin). Omit for u/0.
Output
n requiredquery requiredemails requiredExample output
Shape only: placeholder values generated from the output schema, not a real run.
{
"n": 3,
"query": "…",
"emails": [
{}
]
}