-
Notifications
You must be signed in to change notification settings - Fork 514
Description
Problem
When using gws mcp in compact mode (--tool-mode compact) with an AI assistant (Claude Code), the Gmail users.messages.get method returns the full raw API response — including all transport headers (DKIM signatures, ARC chains, SPF records, anti-spam metadata, X-Microsoft-Antispam-MessageData, etc.).
A single email that contains a 2-sentence body returns 50-120KB of JSON. When an AI assistant needs to triage 20+ emails, that's 1-2MB of raw data, most of which is irrelevant routing metadata. This makes compact mode impractical for the primary use case it seems designed for — AI tool use.
What I expected
A way to filter the response, equivalent to Gmail API's fields parameter. For example:
fields: "id,threadId,labelIds,snippet,payload/headers(name=From;Subject;Date),payload/parts/body"
Or even a simpler approach: a --slim flag or response profile that strips transport/security headers and returns only human-relevant fields (From, To, Subject, Date, body text, labels, snippet).
What I tried
format: "metadata"withmetadataHeaders— doesn't return the specified headers in compact mode (known issue per README)format: "minimal"— returns snippet and labels but no sender/subject, so it's not useful for triageformat: "full"— returns everything (50-120KB per message)
Environment
gwsv0.7.0- macOS, compact MCP mode (
gws mcp -s gmail,calendar --tool-mode compact) - AI client: Claude Code (Anthropic)
Suggested solutions (any of these would help)
- Pass through the Gmail API
fieldsparameter in compact mode'sparamsobject - Fix
metadataHeadersin compact mode soformat: "metadata"works as expected - Add a response profile option (e.g.,
--response-profile slim) that strips transport headers and decodes base64 body content before returning - Auto-decode base64 body parts — currently the email body comes back as base64-encoded strings in
payload.parts[].body.data, requiring the AI client to decode them
Impact
Without filtering, compact mode generates responses that are 50-100x larger than what AI assistants need. This effectively blocks adoption for email-heavy workflows (triage, morning briefings, inbox management) which are among the most common AI assistant use cases for Gmail.