Skip to main content
Glama
Albretsen

MCP Emails

Search and Move

email_search_and_move
DestructiveIdempotent

Search your inbox with structured criteria (sender, subject, dates) and move every matching message to a chosen folder in one server-side operation. Filter results securely to avoid moving the wrong mail.

Instructions

Move every message matching a search into a destination folder, in one server-side operation, so no message ID is ever stale by the time it is used. Search uses structured, provider-agnostic fields (from, to, cc, subject, body, text, unread, has_attachment, flagged, since, before) that the server translates into the inbox's native search syntax, so you never need provider query syntax; query is a raw escape hatch. SEPARATE from email_organize, and flagged destructive to your MCP client, because it acts on everything the filter matches rather than on ids you chose: one wrong filter relocates a whole inbox. To move messages you have already listed, use email_organize (action 'move' or 'move_batch') instead. Bounded by limit, maximum and default 500: check has_more before reporting a mailbox fully swept, and finish any remainder with email_organize (action 'move_batch'). On Gmail, moving adds the destination label and removes the INBOX label. Returns succeeded/failed counts and per-message results. Needs manage:folders.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ccNoCc recipient to match: address, name, or fragment.
toNoTo recipient to match: address, name, or fragment.
bodyNoText to find in the body. On Gmail this matches the whole message.
fromNoSender to match: address, name, or fragment.
textNoText to match anywhere, headers included.
inboxNoInbox email address, an alternative to inbox_id.
limitNoCap on messages moved. Default 500.
queryNoProvider-native raw query (escape hatch); prefer the structured fields. Ignored on Fastmail.
sinceNoReceived on or after this date or datetime (no timezone = UTC).
beforeNoReceived strictly before this date or datetime (no timezone = UTC).
unreadNotrue = unread only; false = read only; omit for both.
flaggedNotrue = only flagged/starred messages. Ignored on Outlook.
subjectNoText to match in the subject; phrases match as-is.
inbox_idNoInbox UUID from inbox_list. Optional when the key has one inbox; pass this or `inbox`, not both.
has_attachmentNotrue = only messages with an attachment. Ignored on generic IMAP.
idempotency_keyNoReuse only when retrying the identical request within 24 hours; the retry is collapsed, not repeated. Reuse with different arguments is rejected.
include_foldersNoFolder names to search. IMAP covers INBOX only when omitted.
destination_folder_idYesTarget folder: an alias (inbox, sent, drafts, trash, archive, spam), a folder name, or a folder id. Names and aliases resolve for you.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoThe limit that bounded the search.
notesNoServer notes about how this call was handled — for example an argument that was not applied because the selected action does not accept it. Written by MCP Emails, not taken from any message, and absent when there is nothing to report.
failedYes
partialNoTrue when the operation did NOT process every message it was given. succeeded/failed describe only what was attempted; remaining_message_ids lists what was left untouched.
resultsYes
has_moreNoTrue when messages matching the query were left UNTOUCHED because of the limit. Check this before reporting the sweep complete: re-run until it is false.
inbox_idYes
operationYes
remainingNo
succeededYes
match_countNoHow many messages the search returned, i.e. the most this call could act on.
continuationNo
limit_noticeNoPresent only when has_more: plain-language statement of what was left behind.
limit_reachedNoTrue when the search filled its window and stopped counting. On its own it does not prove more mail exists; has_more is that claim.
total_matchesNoProvider's total match count when it supplies one.
partial_noticeNo
stopped_reasonNo'cancelled' — a person stopped the run from the dashboard. 'time_budget' — the server stopped on its own wall-clock limit so the result could be returned before the client timed out. Neither is an error.
total_requestedNo
remaining_message_idsNoMessages that were NOT processed and are unchanged. These exact ids, not a repeat of the original search, are what a follow-up call should use.
total_matches_is_estimateNoTrue when total_matches is a provider estimate (Gmail) rather than a count.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the destructiveHint annotation, the description warns that all matching messages are affected, explains that the operation is server-side so message IDs never go stale, notes provider-specific behaviors (Gmail labels, Fastmail raw query limitation), and exposes idempotency behavior. This is substantial value beyond structured 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?

Dense but not wasteful: nearly every sentence adds operational knowledge. It could be lightly restructured into bullets for scannability, but it remains an efficient single block with no filler.

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?

For an 18-parameter, potentially destructive tool, the description covers scope, provider differences, limits, continuation, idempotency, and the key safety boundary between this tool and email_organize. No important operational gap remains.

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 coverage is already 100%, but the description adds meaning: filters are provider-agnostic and translated to native syntax, query is an escape hatch, limit caps the batch, and has_more drives continuation. It does not deeply explain every search field, but the schema already does that.

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?

States a specific operation: 'move every message matching a search into a destination folder in one server-side operation.' It clearly defines what the tool does and explicitly contrasts itself with email_organize, so an agent can distinguish them without opening schemas.

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?

Gives explicit when-to-use guidance (search-based batch move where selected messages are not pre-listed), names the alternative for pre-listed IDs (email_organize move), and explains continuation semantics (limit and has_more). The agent is told exactly how to avoid misuse.

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