search_and_save
Search Gmail and save matching emails directly to a file in one call, avoiding inline output and MCP output limits.
Instructions
One-shot search + save: search Gmail and write results directly to a file.
Combines list_emails + read_emails_full into a single tool call.
No data is returned inline — just a compact summary + file path.
Required:
query (str) — Gmail search syntax
(e.g. "from:PiraeusBank after:2026/03/01 has:attachment").
Optional:
max_results (int, default=100) — max emails to fetch.
save_path (str) — local file path. If empty, auto-generates one in
the configured gmail-mcp directory under emails/. Overwrite is rejected — use a fresh
path or let the tool auto-generate.
format (str, default="md") — "md", "json", "jsonl", or "csv".
Returns on success:
{"ok": true, "data": {
"saved": true,
"path": "C:\Users\...\emails\2026-05-11-piraeus-47.md",
"count": 47,
"format": "md",
"total_size_bytes": 184523,
"query": "from:PiraeusBank after:2026/03/01",
"search_summary": "47 emails matched your search query"
}}
Workflow note: Use this when you want to search Gmail and immediately
persist results to a file without worrying about MCP output limits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| format | No | md | |
| save_path | No | ||
| max_results | No |