Skip to main content
Glama

search

Read-only

Find Gmail threads by sender, subject, date, label, or read state with native query syntax; get summary results and paginate for more.

Instructions

Search Gmail with native query syntax (e.g. 'in:inbox from:foo@bar.com newer_than:7d'). Returns thread summaries; read-state/category predicates are re-verified against each hit's live labels. from, subject and date are the thread's FIRST message (its origin); snippet is Gmail's and comes from the LAST. lastMessageDate and lastMessageId name that last message, so 'did anything new arrive?' is a comparison of lastMessageId against the one you saw, not of messageCount against a remembered count — and get_thread with afterMessageId: <the id you saw> then returns only what is new. lastMessageFrom names who wrote that last message and lastMessageSent is true when it was this mailbox, so 'has the other side answered?' is lastMessageSent: false. unread is true when any message of the thread is unread, read off the live labels rather than the search index. attachments lists what is attached (filename, declared mimeType, size; at most 10, attachmentCount is the total), so 'is there a PDF to keep before archiving?' needs no get_thread — the mimeType is what the sender declared, so check the filename too when it says application/octet-stream. Each summary carries signals derived from the thread's first message headers/MIME — newsletter (List-Id/List-Unsubscribe/Precedence bulk, junk or list), automated (Auto-Submitted, auto-reply/suppress headers, no-reply-style senders), calendar (text/calendar or .ics part), replyToMismatch (a Reply-To on another domain than From — a subdomain of the same domain counts as the same), displayNameSpoof (the From display name shows an address or URL on another domain than the one the mail came from), lookalikeDomain (a From domain label mixing Latin with Cyrillic, Greek or Armenian letters); empty when nothing is declared. Paginated: when more results exist, the response carries a nextPageToken — pass it back via pageToken to fetch the next page. A page can come back with FEWER threads than maxResults and still have a nextPageToken: false positives from the index consume the scan window, and on a mailbox whose read state the index has fallen behind on, most candidates for an is:unread query can be already-read mail. A short page is therefore not evidence that the result set is exhausted — only an absent nextPageToken is. SPAM AND TRASH ARE EXCLUDED unless the query names them. Gmail leaves both out of any query that does not say in:spam / in:trash, so a plain from:someone returns nothing for a mail that is sitting in spam — measured against a live mailbox, not assumed. Nothing in the result marks the omission, so treat 'no hits' as 'none outside spam and trash'. When mail the user expects is missing, retry with in:spam before reporting that it does not exist: mail is often filed as spam because of something the user just did — a signup, a password reset, an order confirmation — which is precisely what a spam filter cannot know and the caller often can. USE WHEN: locating threads by sender, subject, date, label, or read state. DO NOT USE: to fetch a thread you already have the ID of (use get_thread). SIDE EFFECTS: none.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "search"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYes
pageTokenNo
maxResultsNo

Output Schema

NameRequiredDescriptionDefault
threadsYes
nextPageTokenNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv0.25.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedOutput schema / properties / threads / items / properties / attachmentCount
      Added value: +{
      +  "type": "number"
      +}
    • addedOutput schema / properties / threads / items / properties / attachments
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "filename": {
      +        "type": "string"
      +      },
      +      "mimeType": {
      +        "type": "string"
      +      },
      +      "size": {
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "filename",
      +      "mimeType",
      +      "size"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / threads / items / properties / lastMessageDate
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / threads / items / properties / lastMessageFrom
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / threads / items / properties / lastMessageId
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / threads / items / properties / lastMessageSent
      Added value: +{
      +  "type": "boolean"
      +}
    • changedOutput schema / properties / threads / items / properties / signals / items / enum
      Previous value: -[
      -  "newsletter",
      -  "automated",
      -  "calendar",
      -  "replyToMismatch"
      -]New value: +[
      +  "newsletter",
      +  "automated",
      +  "calendar",
      +  "replyToMismatch",
      +  "displayNameSpoof",
      +  "lookalikeDomain"
      +]
    • addedOutput schema / properties / threads / items / properties / unread
      Added value: +{
      +  "type": "boolean"
      +}
    • changedOutput schema / properties / threads / items / required
      Previous value: -[
      -  "threadId",
      -  "messageCount",
      -  "from",
      -  "subject",
      -  "date",
      -  "labelIds",
      -  "snippet",
      -  "hasAttachments",
      -  "signals"
      -]New value: +[
      +  "threadId",
      +  "messageCount",
      +  "from",
      +  "subject",
      +  "date",
      +  "lastMessageId",
      +  "lastMessageDate",
      +  "lastMessageFrom",
      +  "lastMessageSent",
      +  "unread",
      +  "labelIds",
      +  "snippet",
      +  "hasAttachments",
      +  "attachments",
      +  "attachmentCount",
      +  "signals"
      +]
  2. Changed2 schema fields changedv0.11.0
    • addedOutput schema / properties / threads / items / properties / signals
      Added value: +{
      +  "items": {
      +    "enum": [
      +      "newsletter",
      +      "automated",
      +      "calendar",
      +      "replyToMismatch"
      +    ],
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / threads / items / required
      Previous value: -[
      -  "threadId",
      -  "messageCount",
      -  "from",
      -  "subject",
      -  "date",
      -  "labelIds",
      -  "snippet",
      -  "hasAttachments"
      -]New value: +[
      +  "threadId",
      +  "messageCount",
      +  "from",
      +  "subject",
      +  "date",
      +  "labelIds",
      +  "snippet",
      +  "hasAttachments",
      +  "signals"
      +]
  3. First observedv0.1.8

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish readOnlyHint and openWorldHint, but the description adds substantial operational context: live-label re-verification, short pages with nextPageToken, spam/trash exclusion, and no side effects. Nothing in the description contradicts the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core purpose and query syntax are front-loaded, followed by return-field semantics, pagination, and exclusions. The description is long and dense, but most sentences add concrete operational value rather than restating the schema or annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the output schema existing, the description still supplies critical behavioral context for search results, pagination quirks, and spam/trash omission. For a search tool with only three parameters and no schema descriptions, this is unusually complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry parameter meaning. It explains the query syntax with concrete examples and describes pageToken round-tripping, but maxResults is only referenced indirectly in pagination discussion rather than being defined as the page size.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: 'Search Gmail with native query syntax'. It immediately distinguishes this from fetching by ID in the DO NOT USE section, so an agent can separate it from get_thread without inspecting the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit USE WHEN conditions (locating threads by sender, subject, date, label, read state) and an explicit DO NOT USE alternative pointing to get_thread. It also adds practical guidance for missing mail via retrying in:spam, which is directly actionable.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.