Gmail

Gmail_SearchEmailsByQuery

Search Gmail with a raw query and return one page in the requested detail mode. Results follow Gmail's default newest-first order. The default ``lightweight`` mode is metadata-only (routing/threading headers, no bodies). Count-only returns unhydrated identifier stubs plus Gmail's approximate match total — useful to estimate how many emails a query would affect before applying a bulk change. Full results add parsed plain and HTML bodies. ``pagination.total_estimate`` is always approximate.

Remote gmail

Remote (network-hosted)

Other tools also called Gmail_SearchEmailsByQuery? See providers with this name

Input Schema


            {
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "description": "Raw Gmail search query. Supports from:, to:, subject:, label:, in:/is:, has:attachment, category:, filename:, before:/after: YYYY/MM/DD, older_than:/newer_than: d/m/y, quoted phrases, implicit AND, OR, grouping with parentheses or braces, and -/NOT negation. Whitespace-only values are rejected."
    },
    "page_token": {
      "type": "string",
      "description": "Opaque page token from a previous response's pagination.next_page_token. Surrounding whitespace is trimmed; omit, leave null, or pass a blank value to fetch the first page."
    },
    "max_results": {
      "type": "integer",
      "description": "Maximum number of matching emails to return on this page. Defaults to 10. Values below 1 are clamped to 1. Values above the active detail mode's cap are clamped, and the response includes limit_clamped_to_max=True when the upper limit is applied."
    },
    "result_detail": {
      "enum": [
        "count_only",
        "lightweight",
        "full"
      ],
      "type": "string",
      "description": "Controls result hydration. Defaults to lightweight (metadata-only): compact previews (sender/to/cc/bcc/reply_to/subject/date/snippet/labels plus Message-ID/In-Reply-To/References) without bodies. count_only returns ID and thread stubs plus Gmail's approximate overall total without fetching message metadata or bodies — use it to estimate how many emails a query would match (for example before a bulk triage or label change). full returns the compact fields plus parsed body and HTML body (not every Gmail resource field); use a small max_results for this payload-heavy mode. full detail is capped at 10; other modes are capped at 50."
    },
    "include_spam_trash": {
      "type": "boolean",
      "description": "Include messages in Spam and Trash. Defaults to false. Automatically set to true when the query has a positive in:/label: operator targeting Spam or Trash."
    }
  }
}
          

Provider

Gmail →