Gmail labelsIMAP foldersEmail providersAI agents

Gmail Labels vs. IMAP Folders for AI Agents: What Changes and What Does Not

Understand the difference between Gmail labels and IMAP folders when connecting an AI agent to email—and how MCPEmails keeps common inbox workflows consistent across providers.

Gmail labels and IMAP folders for AI agents — MCPEmails

Gmail does not organize mail the same way as a traditional IMAP mailbox. Gmail uses labels: one message can carry several labels at once. IMAP providers such as Fastmail, iCloud, Yahoo, Zoho, and many custom-domain hosts use folders or mailboxes: messages live in a hierarchy, and moving a message normally changes where it lives.

That difference matters when an AI agent helps organize email. MCPEmails smooths over the routine differences while being explicit about the provider behavior that should remain visible.

The simple mental model

Think of a Gmail label as a tag attached to a message. A message can be in Inbox, have a “Receipts” label, and also have a “Travel” label. On a traditional mailbox, a folder is closer to a location: moving a message from Inbox to Receipts puts it in Receipts instead of Inbox.

Neither model is better. Labels are flexible for overlapping categories. Folders are familiar and clean for a single filing path. The important thing is that your agent should not silently assume that “move” means the same thing everywhere.

How MCPEmails handles the common workflow

MCPEmails connects Gmail with a Google app password over IMAP, and Gmail's IMAP server shows each label as a folder. A message with three labels appears in three folders. Your agent lists the folders in an inbox with folder_list, then uses the returned folder name when it needs to move, copy, archive, create, rename, or delete one.

On Gmail, creating a folder creates a label. Moving a message out of Inbox to a destination adds that label and removes the Inbox label, and the message keeps its other labels. Archiving removes it from Inbox, and it stays in All Mail. On other IMAP inboxes, moving places the message in the destination folder and takes it out of the old one.

That is a practical kind of compatibility: the same high-level intent works across providers, but the product does not hide a behavior that could surprise the person who owns the mailbox.

Copying is the key difference

Copying a message leaves the original in place. MCPEmails supports copy on every IMAP inbox, Gmail included, and on Outlook. What a copy produces depends on the provider.

If you ask an agent to "put this in Receipts but keep it in the Inbox," the agent copies the message to Receipts in both cases, with a different result:

  • On Gmail, the copy adds the Receipts label to the same message. Nothing is duplicated, and the message still shows in Inbox.
  • On a folder-based inbox, the copy is a second message in Receipts, next to the original in Inbox.

This is why the best instructions state the outcome you want rather than prescribing a provider command. Tell the agent “keep the original visible in Inbox” and let it use the inbox capabilities it discovers.

Search has provider differences too

MCPEmails gives agents structured search fields, such as sender, recipient, subject, body, dates, unread state, and attachments, and translates them into each provider's search. On Gmail connected by app password, that is IMAP search, so Gmail's own operators such as from: or is:unread do not apply. The structured fields make a request like "find unread invoices from May with attachments" portable.

An optional raw query remains available when a provider-specific search is truly needed. On an IMAP inbox, Gmail included, it takes IMAP search syntax. It should be the exception. Structured search is easier to reuse across accounts and helps prevent a workflow from being tied to the quirks of one provider.

A safe organization prompt

Try this after connecting your mailbox:

Find purchase receipts from the last two months. Show me the first 20 matches with sender, date, subject, and the folder each one is in. Do not move anything yet. After I confirm, file the selected messages under Receipts while preserving any labels or folders that should remain visible.

The preview is useful whether you use Gmail labels or IMAP folders. It also prevents an agent from creating a rigid, provider-specific rule before you have seen the actual messages.

One workflow, multiple inboxes

MCPEmails supports Gmail and Google Workspace (with a Google app password over IMAP), Outlook and Microsoft 365 over Microsoft Graph, and IMAP/SMTP mailboxes through app passwords, including Fastmail, iCloud, Yahoo, Zoho, Yandex, and generic providers. Outlook sits on the folder side of this divide, with nested folders and no labels. Connect the account you have; your agent discovers its capabilities instead of assuming every inbox behaves like Gmail.

For a provider-specific setup guide, see Connect iCloud or Fastmail IMAP to Claude. For Gmail, start with How to Connect Gmail to Claude. For any other IMAP mailbox, the IMAP connector guide covers server settings and troubleshooting.

Asgeir Albretsen
Written by
Asgeir Albretsen

Asgeir builds MCPEmails — the bridge that lets AI agents read, search, and send real email over the Model Context Protocol. He writes about agents, email infrastructure, and developer experience.

Give your agent an inbox

Connect Gmail, Outlook, Fastmail, or any IMAP account to your AI agent in minutes.