Skip to main content
Glama
nikolausm

IMAP MCP Server

by nikolausm

imap_search_emails

Find emails by criteria like sender, subject, body, or date range. Search a single folder or across all folders (skipping trash/spam/drafts) to locate messages when you don't know the UID.

Instructions

Search for emails matching criteria (sender, recipient, subject, body text, date range, read/flagged status). Use this to FIND messages when you know something about them but not their UID — e.g. "emails from amazon last week", "unread invoices". By default searches a single folder (INBOX). Set searchAllFolders=true to scan every mailbox at once — this catches messages filed away by rules (e.g. a receipt routed to a custom folder); Trash/Spam/Drafts are skipped unless you opt in. Returns lightweight headers (uid, from, subject, date, and folder when searching across folders); call imap_get_email with a returned uid + folder to read full content. For the newest messages without criteria, prefer imap_get_latest_emails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNoSearch by recipient
bodyNoSearch in body text
fromNoSearch by sender
seenNoFilter by read/unread status
limitNoMaximum number of results
sinceNoSearch emails since date (YYYY-MM-DD)
beforeNoSearch emails before date (YYYY-MM-DD)
folderNoFolder name to search (default: INBOX). Ignored when searchAllFolders is true.INBOX
flaggedNoFilter by flagged status
subjectNoSearch by subject
accountIdNoAccount ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.
messageIdNoSearch by RFC822 Message-ID header (substring match)
accountNameNoAccount name instead of accountId. Optional if accountId is given or only one account is configured.
includeSpamNoWhen searchAllFolders is true, also search Spam/Junk folders (off by default — noisy).
includeTrashNoWhen searchAllFolders is true, also search Trash/Bin/Deleted folders (off by default — noisy).
includeDraftsNoWhen searchAllFolders is true, also search the Drafts folder (off by default).
searchAllFoldersNoSearch across ALL folders instead of just `folder`. Skips Trash/Spam/Drafts and non-selectable folders by default. Use when a message might have been filed/archived/moved and you do not know which folder it is in.
Behavior4/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It transparently describes the default folder (INBOX), that searchAllFolders skips Trash/Spam/Drafts unless opted in, and that it returns lightweight headers with instructions to get full content via imap_get_email. Missing potential details like rate limits or authentication, but covers core behavior well.

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?

The description is concise at about six sentences, each serving a specific purpose. It front-loads the main purpose and criteria, then adds usage guidance, behavioral details, returned data format, and alternatives. There is minimal fluff, though a slight reduction in length could be possible without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the high complexity (17 parameters, 35 sibling tools, no output schema), the description provides a well-rounded understanding: when to use the tool, how it behaves across single vs. all-folder search, what it returns, and how it connects to other tools (imap_get_email, imap_get_latest_emails). It covers essential context for an agent to make correct selection and invocation decisions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds some behavioral context (e.g., 'Trash/Spam/Drafts are skipped unless you opt in' mapping to includeSpam/Trash/Drafts parameters) and examples, but most parameter meaning is already captured in the schema descriptions. The description does not significantly exceed the schema in adding meaning.

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?

The description opens with a specific verb+resource combination ('Search for emails matching criteria') and lists explicit criteria (sender, recipient, subject, body text, date range, read/flagged status). It clearly distinguishes from sibling tools like imap_get_email (which retrieves full content by UID) and imap_get_latest_emails (for newest messages without criteria).

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?

Provides explicit guidance: 'Use this to FIND messages when you know something about them but not their UID' with concrete examples ('emails from amazon last week', 'unread invoices'). Directly advises an alternative: 'For the newest messages without criteria, prefer imap_get_latest_emails.' Also explains when to use searchAllFolders=true (catching messages filed by rules).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nikolausm/imap-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server