Gmail MCP: gmail_search_messages ignores query parameter, returns latest messages regardless

Resolved 💬 5 comments Opened Apr 5, 2026 by ryofukutani Closed May 20, 2026

Bug Description

gmail_search_messages ignores the query parameter entirely and always returns the same latest messages in reverse chronological order, regardless of the search query.

Environment

  • Claude Code CLI (claude-code)
  • Gmail MCP integration via claude.ai managed connection (mcp__claude_ai_Gmail__)
  • Google Workspace account (custom domain)
  • Account has ~1.38M messages

Reproduction

  1. Connect Gmail via /mcp → Reconnect Gmail
  2. Confirm connection works: gmail_get_profile returns correct email ✅
  3. Run any search:
gmail_search_messages({ query: "subject:16633 Multileg" })
gmail_search_messages({ query: "is:starred" })
gmail_search_messages({ query: "from:openapisupport@saxobank.com" })
gmail_search_messages({ query: "in:sent to:openapisupport" })

All four queries return the exact same 5 results — the latest messages in the mailbox (promotional emails, unrelated newsletters). None match the search criteria.

Evidence

  • resultSizeEstimate is always 201 regardless of query
  • Results never include STARRED label even when searching is:starred
  • nextPageToken varies slightly between calls, suggesting the API is being called, but without the q parameter
  • The query string appears to be dropped before reaching the Gmail API's users.messages.list endpoint

What works

| Tool | Status |
|------|--------|
| gmail_get_profile | ✅ Works |
| gmail_list_labels | ✅ Works |
| gmail_list_drafts | ✅ Works |
| gmail_create_draft | ✅ Works |
| gmail_read_message | ✅ Works (with valid API message ID) |
| gmail_search_messages | ❌ Query ignored |

What doesn't work

  • gmail_search_messages — the query parameter has no effect on results
  • gmail_read_thread with web URL thread ID format (FMfcg...) — returns error (expected, different ID format)

Impact

Cannot programmatically find specific email threads, which blocks:

  • Creating draft replies threaded to existing conversations
  • Searching for specific messages by sender, subject, date, or label
  • Any workflow that depends on email search

Attempted fixes

  • /mcp → Reconnect Gmail: did not fix
  • Tried multiple query syntaxes (Gmail search operators, quoted strings, label filters): all ignored

Expected behavior

gmail_search_messages({ query: "subject:16633" }) should return only messages whose subject contains "16633", not the latest messages in the mailbox.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗