{"at":"2026-11-23T02:00:57.738Z","dir":"sent","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"didrun-lab","version":"0.1.0"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T02:00:58.348Z","dir":"received","era":"server_discover","message":{"error":{"code":-32601,"message":"Method not found"},"id":1,"jsonrpc":"2.0"}}
{"at":"2026-11-23T02:00:58.449Z","dir":"sent","era":"initialize","message":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"didrun-lab","version":"0.1.0"},"protocolVersion":"2025-11-25"}}}
{"at":"2026-11-23T02:00:59.118Z","dir":"received","era":"initialize","message":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"tools":{"listChanged":true}},"protocolVersion":"2025-11-25","serverInfo":{"name":"imap-mcp-server","version":"2.2.0"}}}}
{"at":"2026-11-23T02:00:59.118Z","dir":"sent","era":"initialize","message":{"jsonrpc":"2.0","method":"notifications/initialized"}}
{"at":"2026-11-23T02:00:59.118Z","dir":"sent","era":"initialize","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}}}
{"at":"2026-11-23T02:00:59.127Z","dir":"received","era":"initialize","message":{"id":2,"jsonrpc":"2.0","result":{"tools":[{"description":"Add a new IMAP account configuration","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"allowStartTLS":{"description":"When tls is false, imapflow still opportunistically upgrades via STARTTLS if the server advertises it, validating the cert against `host` regardless of `tls`. Set to false to disable that upgrade and stay on the plain connection — needed for providers (e.g. some DreamHost mail hosting) that advertise STARTTLS on a hostname covered only by a shared/wildcard cert. Defaults to true.","type":"boolean"},"allowedFrom":{"description":"Additional sender identities allowed in the From header. The account email and login are always allowed.","items":{"type":"string"},"type":"array"},"defaultBcc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"Optional BCC address(es) applied automatically to every outbound send, reply, forward, and draft for this account. Merged with any per-call bcc"},"email":{"description":"Email address (From: header). Defaults to user if omitted","type":"string"},"host":{"description":"IMAP server hostname","type":"string"},"name":{"description":"Friendly name for the account","type":"string"},"password":{"description":"Password for authentication","type":"string"},"port":{"default":993,"description":"IMAP server port (default: 993)","type":"number"},"sentFolder":{"description":"Explicit Sent-folder name for saving sent-mail copies (e.g. \"Gesendet\"). Only needed when auto-detection fails — the server must lack a \\Sent SPECIAL-USE folder. Check names with imap_list_folders","type":"string"},"smtpHost":{"description":"SMTP server hostname. Defaults to IMAP host with imap.→smtp. rewrite","type":"string"},"smtpPort":{"description":"SMTP server port (465 for SMTPS, 587 for STARTTLS). Defaults to 587","type":"number"},"smtpSecure":{"description":"Use implicit TLS (SMTPS). Ignored for port 587/25 which always use STARTTLS, and for port 465 which always uses implicit TLS","type":"boolean"},"tls":{"default":true,"description":"Use TLS/SSL (default: true)","type":"boolean"},"user":{"description":"Username for authentication","type":"string"}},"required":["name","host","user","password"],"type":"object"},"name":"imap_add_account"},{"description":"Update an existing IMAP account. Useful for fixing SMTP settings without removing and re-adding the account.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"ID of the account to update","type":"string"},"allowStartTLS":{"description":"When tls is false, set to false to also disable imapflow's opportunistic STARTTLS upgrade (see imap_add_account). Defaults to true.","type":"boolean"},"allowedFrom":{"description":"Additional sender identities allowed in the From header. Pass an empty array to clear.","items":{"type":"string"},"type":"array"},"defaultBcc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"Optional BCC address(es) applied automatically to every outbound message for this account. Pass an empty string to clear"},"email":{"description":"Email address (From: header)","type":"string"},"host":{"description":"IMAP host","type":"string"},"name":{"description":"New friendly name","type":"string"},"password":{"description":"New password","type":"string"},"port":{"description":"IMAP port","type":"number"},"saveToSent":{"description":"Save sent emails to the Sent folder","type":"boolean"},"sentFolder":{"description":"Explicit Sent-folder name for saving sent-mail copies (e.g. \"Gesendet\"). Overrides auto-detection; pass an empty string to clear the override and re-enable auto-detection. Check names with imap_list_folders","type":"string"},"smtpHost":{"description":"SMTP hostname","type":"string"},"smtpPassword":{"description":"SMTP password (if different from IMAP password)","type":"string"},"smtpPort":{"description":"SMTP port (465 for SMTPS, 587 for STARTTLS)","type":"number"},"smtpSecure":{"description":"Use implicit TLS (SMTPS). Port 587/25 always use STARTTLS regardless","type":"boolean"},"smtpUser":{"description":"SMTP username (if different from IMAP user)","type":"string"},"tls":{"description":"Use TLS for IMAP","type":"boolean"},"user":{"description":"IMAP username","type":"string"}},"required":["accountId"],"type":"object"},"name":"imap_update_account"},{"description":"List all configured IMAP accounts","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{},"type":"object"},"name":"imap_list_accounts"},{"description":"Remove an IMAP account configuration","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"ID of the account to remove","type":"string"}},"required":["accountId"],"type":"object"},"name":"imap_remove_account"},{"description":"Connect to an IMAP account","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID to connect to","type":"string"},"accountName":{"description":"Account name to connect to","type":"string"}},"type":"object"},"name":"imap_connect"},{"description":"Disconnect from an IMAP account","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID to disconnect from","type":"string"}},"required":["accountId"],"type":"object"},"name":"imap_disconnect"},{"description":"Test an existing account connection without re-entering credentials. Validates IMAP connectivity and returns folder count and message count.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID to test","type":"string"}},"required":["accountId"],"type":"object"},"name":"imap_test_account"},{"description":"Note: on some servers a 'flagged' or starred message carries a custom keyword (e.g. an Open-Xchange color label or Apple's $MailFlagBit*) instead of, or in addition to, the \\Flagged system flag. After any flagged search, inspect each result's customKeywords field before concluding a message is or isn't flagged — do not rely on the flagged filter alone. 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. By default returns lightweight headers (uid, from, subject, date, and folder when searching across folders); set `includeBody=true` to also return the parsed body in one round-trip instead of paying the N+1 cost of calling imap_get_email per match. For the newest messages without criteria, prefer imap_get_latest_emails.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"before":{"description":"Search emails before date (YYYY-MM-DD)","type":"string"},"body":{"description":"Search in body text","type":"string"},"bodyFormat":{"default":"markdown","description":"How to render the body when `includeBody` is true. Mirrors `imap_get_email` — \"markdown\" (default) returns clean Markdown and omits raw HTML so it never crosses the MCP boundary; \"text\" returns plain text; \"html\" returns raw HTML; \"auto\" prefers substantive text/plain, else Markdown.","enum":["markdown","text","html","auto"],"type":"string"},"bodyMaxLength":{"default":10000,"description":"Per-message cap (in characters) for each rendered body field when `includeBody` is true. Defaults to 10000 to match `imap_get_email`.","type":"number"},"flagged":{"description":"Filter by flagged status","type":"boolean"},"folder":{"default":"INBOX","description":"Folder name to search (default: INBOX). Ignored when searchAllFolders is true.","type":"string"},"from":{"description":"Search by sender","type":"string"},"includeBody":{"default":false,"description":"If true, also fetch the parsed message body in the same round-trip and return it alongside headers (avoids the N+1 cost of calling imap_get_email per match). Body is rendered per `bodyFormat` and capped at `bodyMaxLength` characters per field. Off by default to preserve lightweight behavior.","type":"boolean"},"includeDrafts":{"default":false,"description":"When searchAllFolders is true, also search the Drafts folder (off by default).","type":"boolean"},"includeSpam":{"default":false,"description":"When searchAllFolders is true, also search Spam/Junk folders (off by default — noisy).","type":"boolean"},"includeTrash":{"default":false,"description":"When searchAllFolders is true, also search Trash/Bin/Deleted folders (off by default — noisy).","type":"boolean"},"keywords":{"description":"Match messages that have ANY of these CUSTOM keywords (server-side OR; not system flags like \\Seen/\\Flagged). Read a mailbox's available custom keywords from imap_folder_status's customKeywords field, then pass the ones you want here.","items":{"type":"string"},"type":"array"},"limit":{"default":50,"description":"Maximum number of results","type":"number"},"messageId":{"description":"Search by RFC822 Message-ID header (substring match)","type":"string"},"searchAllFolders":{"default":false,"description":"Search 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.","type":"boolean"},"seen":{"description":"Filter by read/unread status","type":"boolean"},"since":{"description":"Search emails since date (YYYY-MM-DD)","type":"string"},"subject":{"description":"Search by subject","type":"string"},"to":{"description":"Search by recipient","type":"string"},"unKeywords":{"description":"Exclude messages that have ANY of these CUSTOM keywords (server-side; result has NONE of them). Same keyword source as `keywords` — check imap_folder_status first.","items":{"type":"string"},"type":"array"}},"type":"object"},"name":"imap_search_emails"},{"description":"Read the FULL content of a single email by its UID (body, sender/recipients, date, attachment list, optional raw headers and text-attachment previews). By default the body is returned as clean Markdown in markdownContent and raw HTML is omitted so it never crosses the boundary; set bodyFormat to \"html\" for the legacy raw htmlContent, or \"text\" for plain text only. Use after imap_search_emails or imap_get_latest_emails gives you a uid. Body text is truncated to maxContentLength to protect the context window — raise it for long messages. To fetch attachment bytes, use imap_download_attachment.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"bodyFormat":{"default":"markdown","description":"How to return the body. \"markdown\" (default): clean Markdown via Turndown in markdownContent, raw htmlContent omitted so HTML never crosses the boundary. \"text\": plain text only in textContent. \"html\": legacy raw htmlContent. \"auto\": substantive text/plain if available, else Markdown.","enum":["markdown","text","html","auto"],"type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"includeAttachmentText":{"default":true,"description":"Include text attachment previews when available","type":"boolean"},"includeHeaders":{"default":false,"description":"Include raw email headers (e.g. List-Unsubscribe, List-Unsubscribe-Post)","type":"boolean"},"maxAttachmentTextChars":{"default":100000,"description":"Maximum characters to return per text attachment","type":"number"},"maxContentLength":{"default":10000,"description":"Maximum characters to return for each body field (text/markdown/html)","type":"number"},"uid":{"description":"Email UID","type":"number"}},"required":["uid"],"type":"object"},"name":"imap_get_email"},{"description":"Upload a file to the server for use as an email attachment. Returns a path that can be used with imap_send_email attachments. This allows sending large attachments without hitting context window limits. Max size: 26214400 bytes (configurable via IMAP_MAX_UPLOAD_SIZE). Uploads are auto-deleted after 86400000 ms (configurable via IMAP_UPLOAD_TTL_MS).","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"content":{"description":"Base64 encoded file content","type":"string"},"contentType":{"description":"MIME type (optional, used for metadata only)","type":"string"},"filename":{"description":"Filename to save as","type":"string"}},"required":["filename","content"],"type":"object"},"name":"imap_upload_file"},{"description":"Download a single attachment from an email (folder + uid + attachment filename/contentId, as listed by imap_get_email). Images are returned inline for viewing; PDFs are saved and their text is extracted inline (extractText); other files are saved to the shared downloads directory (or savePath). Use when the user wants the actual file contents, not just the message body.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"extractText":{"default":true,"description":"For PDFs, extract and return text content inline","type":"boolean"},"filename":{"description":"Attachment filename or contentId as listed by imap_get_email. Matched exactly first, then Unicode-normalized (NFC/NFD spellings of umlauts and accents are treated as equal); a contentId may be given with or without its angle brackets","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"savePath":{"description":"Optional file path to save the attachment to. If not provided, files are saved to the shared downloads directory.","type":"string"},"uid":{"description":"Email UID","type":"number"}},"required":["uid","filename"],"type":"object"},"name":"imap_download_attachment"},{"description":"Mark one or many emails as read. Accepts a single UID or an array — pass an array to flag N messages in one IMAP STORE round-trip (useful when triaging).","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"uid":{"anyOf":[{"type":"number"},{"items":{"type":"number"},"type":"array"}],"description":"Email UID, or array of UIDs to mark as read in one call (avoids N round-trips when triaging). All listed UIDs share the same IMAP STORE command, so the operation is atomic at the server level."}},"required":["uid"],"type":"object"},"name":"imap_mark_as_read"},{"description":"Mark one or many emails as unread. Accepts a single UID or an array — pass an array to flag N messages in one IMAP STORE round-trip.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"uid":{"anyOf":[{"type":"number"},{"items":{"type":"number"},"type":"array"}],"description":"Email UID, or array of UIDs to mark as unread in one call (avoids N round-trips when triaging). All listed UIDs share the same IMAP STORE command, so the operation is atomic at the server level."}},"required":["uid"],"type":"object"},"name":"imap_mark_as_unread"},{"description":"Flag an email — sets the IMAP \\Flagged system flag (shows as a star in Gmail / a flag in Apple Mail). Use this tool when a user asks to star, flag, or mark a message as important.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"uid":{"description":"Email UID","type":"number"}},"required":["uid"],"type":"object"},"name":"imap_flag_email"},{"description":"Unflag an email — removes the IMAP \\Flagged system flag (the star in Gmail, the flag in Apple Mail). Note: some servers (e.g. Open-Xchange / Network Solutions) and Apple Mail also write a separate custom keyword such as $cl_N or $MailFlagBit* when a message is flagged in their client. Removing \\Flagged alone does not clear that keyword, so the message may still display as flagged. If it does, check the message's customKeywords via imap_get_email and remove the lingering label with imap_remove_keyword.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"uid":{"description":"Email UID","type":"number"}},"required":["uid"],"type":"object"},"name":"imap_unflag_email"},{"description":"Set an arbitrary custom (non-system) IMAP keyword/label on an email — e.g. a provider color label like Open-Xchange's $cl_1..$cl_10, Apple Mail's $MailFlagBit0..$MailFlagBit2, or an app tag such as $promotion. Unlike imap_flag_email (which only ever sets the system \\Flagged flag), this passes the keyword through verbatim, but rejects backslash-prefixed system flags (e.g. \\Flagged, \\Seen, \\Deleted) — use the dedicated flag/read tools for those. Not every IMAP server permits custom keywords (see the mailbox's PERMANENTFLAGS) — if the server rejects or silently ignores the change, this call fails rather than reporting success.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"keyword":{"description":"IMAP keyword to set, passed through verbatim (e.g. \"$cl_3\", \"$MailFlagBit0\", \"$Junk\")","type":"string"},"uid":{"description":"Email UID","type":"number"}},"required":["uid","keyword"],"type":"object"},"name":"imap_add_keyword"},{"description":"Remove an arbitrary custom (non-system) IMAP keyword/label from an email — e.g. a provider color label like Open-Xchange's $cl_1..$cl_10, Apple Mail's $MailFlagBit0..$MailFlagBit2, or an app tag such as $promotion. Unlike imap_unflag_email (which only ever clears the system \\Flagged flag), this passes the keyword through verbatim, but rejects backslash-prefixed system flags (e.g. \\Flagged, \\Seen, \\Deleted) — use the dedicated flag/read tools for those. Not every IMAP server permits custom keywords (see the mailbox's PERMANENTFLAGS) — if the server rejects or silently ignores the change, this call fails rather than reporting success.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"keyword":{"description":"IMAP keyword to remove, passed through verbatim (e.g. \"$cl_3\", \"$MailFlagBit0\", \"$Junk\")","type":"string"},"uid":{"description":"Email UID","type":"number"}},"required":["uid","keyword"],"type":"object"},"name":"imap_remove_keyword"},{"description":"Delete ONE email by folder + uid (moves to Trash or expunges, server-dependent). Destructive and not easily undone — confirm the user means this specific message. To remove many at once use imap_bulk_delete (known uids) or imap_bulk_delete_by_search (by criteria, supports dryRun). To file an email away instead of deleting, use imap_move_email.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"uid":{"description":"Email UID","type":"number"}},"required":["uid"],"type":"object"},"name":"imap_delete_email"},{"description":"Move an email from one folder to another (e.g., INBOX to Taxes, or INBOX to Archive). Optionally creates the destination folder if it does not exist.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"createDestinationIfMissing":{"description":"If true, create the destination folder before moving when it does not exist (default: false)","type":"boolean"},"folder":{"default":"INBOX","description":"Source folder name","type":"string"},"targetFolder":{"description":"Destination folder name","type":"string"},"uid":{"anyOf":[{"type":"number"},{"items":{"type":"number"},"type":"array"}],"description":"Single email UID or array of UIDs to move in one call. Pass an array when triaging many messages at once (e.g. \"move the 10 invoices I just classified to Archive\") to avoid N round-trips."}},"required":["uid","targetFolder"],"type":"object"},"name":"imap_move_email"},{"description":"Delete multiple emails at once with chunking and auto-reconnection. Processes deletions in batches to prevent connection timeouts.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"chunkSize":{"default":50,"description":"Number of emails to delete per batch (default: 50)","type":"number"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"uids":{"description":"Array of email UIDs to delete","items":{"type":"number"},"type":"array"}},"required":["uids"],"type":"object"},"name":"imap_bulk_delete"},{"description":"Search for emails matching criteria and delete them all. Useful for cleaning up spam or unwanted emails. At least one concrete criterion (from, to, subject, before, or since) is REQUIRED — a call with no criteria is refused so it can never wipe an entire folder. Supports dryRun to preview matches first.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"before":{"description":"Delete emails before this date (YYYY-MM-DD)","type":"string"},"chunkSize":{"default":50,"description":"Number of emails to delete per batch","type":"number"},"dryRun":{"default":false,"description":"If true, only return what would be deleted without actually deleting","type":"boolean"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"from":{"description":"Delete emails from this sender","type":"string"},"since":{"description":"Delete emails since this date (YYYY-MM-DD)","type":"string"},"subject":{"description":"Delete emails with this subject","type":"string"},"to":{"description":"Delete emails to this recipient","type":"string"}},"type":"object"},"name":"imap_bulk_delete_by_search"},{"description":"Get the most recent emails from a folder, newest first. Use this for \"what just came in?\" / \"show my latest inbox messages\" when no search filter is needed. By default returns lightweight headers (uid, from, subject, date); set `includeBody=true` to also return the parsed body in one round-trip instead of paying the N+1 cost of calling imap_get_email per message. To filter by sender/subject/date instead, use imap_search_emails.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"bodyFormat":{"default":"markdown","description":"How to render the body when `includeBody` is true. Mirrors `imap_get_email` — \"markdown\" (default) returns clean Markdown; \"text\" returns plain text; \"html\" returns raw HTML; \"auto\" prefers substantive text/plain, else Markdown.","enum":["markdown","text","html","auto"],"type":"string"},"bodyMaxLength":{"default":10000,"description":"Per-message cap (in characters) for each rendered body field when `includeBody` is true. Defaults to 10000 to match `imap_get_email`.","type":"number"},"count":{"default":10,"description":"Number of emails to retrieve","type":"number"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"includeBody":{"default":false,"description":"If true, also fetch the parsed message body in the same round-trip and return it alongside headers (avoids the N+1 cost of calling imap_get_email per message). Body is rendered per `bodyFormat` and capped at `bodyMaxLength` characters per field. Off by default to preserve lightweight behavior.","type":"boolean"}},"type":"object"},"name":"imap_get_latest_emails"},{"description":"Compose and send a NEW email via the account's SMTP server (a copy is saved to Sent unless disabled; account defaultBcc addresses are always BCC'd when configured). Use for fresh outbound messages. To respond to an existing message use imap_reply_to_email (keeps threading); to pass a message on use imap_forward_email; to store without sending use imap_save_draft. Supports to/cc/bcc, text and/or HTML, and attachments by base64 content or by file path (see imap_upload_file for large files).","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"attachments":{"description":"Email attachments","items":{"properties":{"cid":{"description":"Content-ID for inline attachments. Required when contentDisposition is \"inline\" and the HTML references the image as <img src=\"cid:THIS_VALUE\">. Must match exactly (without the \"cid:\" prefix or angle brackets).","type":"string"},"content":{"description":"Base64 encoded content. Provide exactly one of content or path.","type":"string"},"contentDisposition":{"description":"How the attachment is presented. Use \"inline\" for images referenced from the HTML body via cid: (e.g. a signature/footer banner); omit or use \"attachment\" for regular downloadable files.","enum":["attachment","inline"],"type":"string"},"contentType":{"description":"MIME type. When omitted it is detected from the filename extension (e.g. .pdf → application/pdf); unknown extensions fall back to application/octet-stream.","type":"string"},"filename":{"description":"Attachment filename","type":"string"},"path":{"description":"Readable local file path to attach. Provide exactly one of path or content; paths returned by imap_upload_file are accepted.","type":"string"}},"required":["filename"],"type":"object"},"type":"array"},"bcc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"BCC recipients. Either an array of addresses or a single comma-separated string; merged with the account defaultBcc when set."},"body":{"description":"Alias for 'text' (backward-compat with clients that pass 'body')","type":"string"},"cc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"CC recipients. Either an array of addresses or a single comma-separated string."},"dryRun":{"default":false,"description":"Validate attachments and compose MIME without sending SMTP mail or saving a Sent copy. Use to diagnose attachment payloads safely before sending.","type":"boolean"},"from":{"description":"Sender identity. Must match the account email/login or an address configured in allowedFrom.","type":"string"},"html":{"description":"HTML content","type":"string"},"replyTo":{"description":"Reply-to address","type":"string"},"subject":{"description":"Email subject","type":"string"},"text":{"description":"Plain text content","type":"string"},"to":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"Recipient email address(es). Either an array of addresses or a single comma-separated string; both accept \"Name <addr@example.com>\" form."}},"required":["to","subject"],"type":"object"},"name":"imap_send_email"},{"description":"Save an email as a draft in the Drafts folder (no send). Takes the same fields as imap_send_email (including account defaultBcc when configured).","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"attachments":{"description":"Email attachments","items":{"properties":{"cid":{"description":"Content-ID for inline attachments. Required when contentDisposition is \"inline\" and the HTML references the image as <img src=\"cid:THIS_VALUE\">. Must match exactly (without the \"cid:\" prefix or angle brackets).","type":"string"},"content":{"description":"Base64 encoded content. Provide exactly one of content or path.","type":"string"},"contentDisposition":{"description":"How the attachment is presented. Use \"inline\" for images referenced from the HTML body via cid: (e.g. a signature/footer banner); omit or use \"attachment\" for regular downloadable files.","enum":["attachment","inline"],"type":"string"},"contentType":{"description":"MIME type. When omitted it is detected from the filename extension (e.g. .pdf → application/pdf); unknown extensions fall back to application/octet-stream.","type":"string"},"filename":{"description":"Attachment filename","type":"string"},"path":{"description":"Readable local file path to attach. Provide exactly one of path or content; paths returned by imap_upload_file are accepted.","type":"string"}},"required":["filename"],"type":"object"},"type":"array"},"bcc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"BCC recipients. Either an array of addresses or a single comma-separated string; merged with the account defaultBcc when set."},"body":{"description":"Alias for 'text' (backward-compat)","type":"string"},"cc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"CC recipients. Either an array of addresses or a single comma-separated string."},"folder":{"description":"Override the Drafts folder name (defaults to auto-detected Drafts folder)","type":"string"},"from":{"description":"Sender identity. Must match the account email/login or an address configured in allowedFrom.","type":"string"},"html":{"description":"HTML content","type":"string"},"inReplyTo":{"description":"Message-Id being replied to","type":"string"},"references":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"References header value(s)"},"replyTo":{"description":"Reply-to address","type":"string"},"subject":{"description":"Email subject","type":"string"},"text":{"description":"Plain text content","type":"string"},"to":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"Recipient email address(es). Either an array of addresses or a single comma-separated string."}},"type":"object"},"name":"imap_save_draft"},{"description":"Reply to an existing email identified by folder + uid. Automatically sets the recipient to the original sender, prefixes the subject with \"Re:\", and preserves threading (In-Reply-To/References). Set replyAll to also include the original To (and Cc as Cc), excluding the account's own address; a Reply-To header on the original is honoured. Use this instead of imap_send_email whenever the user is responding to a message already in a mailbox. Account defaultBcc addresses are always BCC'd when configured.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"attachments":{"description":"Email attachments","items":{"properties":{"cid":{"description":"Content-ID for inline attachments. Required when contentDisposition is \"inline\" and the HTML references the image as <img src=\"cid:THIS_VALUE\">. Must match exactly (without the \"cid:\" prefix or angle brackets).","type":"string"},"content":{"description":"Base64 encoded content. Provide exactly one of content or path.","type":"string"},"contentDisposition":{"description":"How the attachment is presented. Use \"inline\" for images referenced from the HTML body via cid: (e.g. a signature/footer banner); omit or use \"attachment\" for regular downloadable files.","enum":["attachment","inline"],"type":"string"},"contentType":{"description":"MIME type. When omitted it is detected from the filename extension (e.g. .pdf → application/pdf); unknown extensions fall back to application/octet-stream.","type":"string"},"filename":{"description":"Attachment filename","type":"string"},"path":{"description":"Readable local file path to attach. Provide exactly one of path or content; paths returned by imap_upload_file are accepted.","type":"string"}},"required":["filename"],"type":"object"},"type":"array"},"bcc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"BCC recipients. Either an array of addresses or a single comma-separated string; merged with the account defaultBcc when set."},"body":{"description":"Alias for 'text' (backward-compat)","type":"string"},"folder":{"default":"INBOX","description":"Folder containing the original email","type":"string"},"from":{"description":"Sender identity. Must match the account email/login or an address configured in allowedFrom.","type":"string"},"html":{"description":"HTML reply content","type":"string"},"replyAll":{"default":false,"description":"Reply to all recipients","type":"boolean"},"text":{"description":"Plain text reply content","type":"string"},"uid":{"description":"UID of the email to reply to","type":"number"}},"required":["uid"],"type":"object"},"name":"imap_reply_to_email"},{"description":"Forward an existing email (folder + uid) to new recipients, quoting the original message and headers. Optionally include the original attachments. Use when the user wants to pass an existing message on to someone else; use imap_reply_to_email instead to respond to the sender. Account defaultBcc addresses are always BCC'd when configured.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"bcc":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"BCC recipients. Either an array of addresses or a single comma-separated string; merged with the account defaultBcc when set."},"body":{"description":"Alias for 'text' (backward-compat)","type":"string"},"folder":{"default":"INBOX","description":"Folder containing the original email","type":"string"},"from":{"description":"Sender identity. Must match the account email/login or an address configured in allowedFrom.","type":"string"},"includeAttachments":{"default":true,"description":"Include original attachments","type":"boolean"},"text":{"description":"Additional text to include","type":"string"},"to":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"Forward to email address(es). Either an array of addresses or a single comma-separated string."},"uid":{"description":"UID of the email to forward","type":"number"}},"required":["uid","to"],"type":"object"},"name":"imap_forward_email"},{"description":"Find messages in `searchFolder` that belong to the same conversation threads as messages already in `sourceFolder`. Useful for catching replies that arrived after a thread was sorted. Works on any IMAP server (uses RFC 3501 HEADER search on In-Reply-To and References). Set `includeBody=true` to also return the parsed body for each found thread message in one round-trip — avoids the N+1 cost of calling imap_get_email per thread member.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"bodyFormat":{"default":"markdown","description":"How to render the body when `includeBody` is true. Mirrors `imap_get_email` — \"markdown\" (default) returns clean Markdown; \"text\" returns plain text; \"html\" returns raw HTML; \"auto\" prefers substantive text/plain, else Markdown.","enum":["markdown","text","html","auto"],"type":"string"},"bodyMaxLength":{"default":10000,"description":"Per-message cap (in characters) for each rendered body field when `includeBody` is true. Defaults to 10000 to match `imap_get_email`.","type":"number"},"includeBody":{"default":false,"description":"If true, also fetch the parsed message body for each found thread message in the same round-trip and return it alongside headers (avoids the N+1 cost of calling imap_get_email per thread member). Body is rendered per `bodyFormat` and capped at `bodyMaxLength` characters per field.","type":"boolean"},"searchFolder":{"default":"INBOX","description":"Folder to search for related thread messages (default: INBOX)","type":"string"},"searchReferences":{"description":"Also search the References header for multi-level threads (default: true)","type":"boolean"},"sourceFolder":{"description":"Folder containing the already-sorted thread messages (e.g. \"Review.Articles\")","type":"string"}},"required":["sourceFolder"],"type":"object"},"name":"imap_find_thread_messages"},{"description":"Locate an email by its RFC822 Message-ID across folders and return its current { folder, uid } plus basic envelope. Robust to the message having been moved or archived (IMAP UIDs are folder-relative). Pass the returned folder + uid to imap_reply_to_email or imap_get_email. Without `folders`, searches Gmail \\All Mail when present, else INBOX → Archive → Sent → remaining folders.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID","type":"string"},"folders":{"description":"Explicit folders to search, in order (overrides the default order)","items":{"type":"string"},"type":"array"},"messageId":{"description":"RFC822 Message-ID, with or without angle brackets","type":"string"}},"required":["accountId","messageId"],"type":"object"},"name":"imap_find_email_by_message_id"},{"description":"List all folders/mailboxes for an account (names, hierarchy delimiter, attributes, RFC 6154 special-use role). Use this first to discover exact folder names before searching, moving, or creating subfolders — folder naming varies by provider (e.g. \"Archive\" vs \"[Gmail]/All Mail\" vs \"INBOX.Archive\"). The specialUse field (\"\\\\Sent\", \"\\\\Drafts\", \"\\\\Trash\", \"\\\\Junk\", \"\\\\Archive\") identifies a folder's role independent of its localized name (e.g. \"Gesendet\" is the Sent folder when specialUse is \"\\\\Sent\").","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"}},"type":"object"},"name":"imap_list_folders"},{"description":"Get status information about a folder","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"description":"Folder name","type":"string"}},"required":["folder"],"type":"object"},"name":"imap_folder_status"},{"description":"Create a new IMAP folder/mailbox. Most servers also create any missing parent folders (e.g. creating \"Archives/2026/2026-05\" auto-creates \"Archives\" and \"Archives/2026\"). Returns success even if the folder already exists.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folder":{"description":"Full folder path to create (e.g. \"Archives/2026/2026-05\" or \"INBOX.Archive\")","type":"string"}},"required":["folder"],"type":"object"},"name":"imap_create_folder"},{"description":"Count unread (unseen) emails per folder, plus a total. Use for \"how many unread do I have?\" overviews. Defaults to all folders; pass a folders list to limit scope and speed it up.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured.","type":"string"},"accountName":{"description":"Account name instead of accountId. Optional if accountId is given or only one account is configured.","type":"string"},"folders":{"description":"List of folders to check (default: all)","items":{"type":"string"},"type":"array"}},"type":"object"},"name":"imap_get_unread_count"},{"description":"Check emails in a folder for spam. Combines sender-domain checks (known spam/disposable domains, suspicious patterns) with deterministic raw-header analysis: bulk-mailer X-Mailer/User-Agent signatures, Precedence: bulk, DMARC/SPF/DKIM failures in Authentication-Results, and List-Unsubscribe / Reply-To domains that do not match the sender. Header checks catch scam mail from fresh, unlisted domains that pass the domain check. Returns domain-based spam, a separate list of header-flagged mails, and domain statistics.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"from":{"description":"Filter by sender (optional)","type":"string"},"includeHeaderChecks":{"default":true,"description":"Also run deterministic raw-header checks (X-Mailer bulk tools, Precedence: bulk, DMARC/SPF/DKIM failures, List-Unsubscribe/Reply-To domain mismatches) on top of the sender-domain check. Fetches message headers in one extra batch round-trip. Set false to skip header analysis and only check sender domains.","type":"boolean"},"limit":{"default":100,"description":"Maximum number of emails to check","type":"number"},"since":{"description":"Check emails since date (YYYY-MM-DD)","type":"string"}},"required":["accountId"],"type":"object"},"name":"imap_check_spam"},{"description":"Find and delete emails from known spam/disposable email domains.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID","type":"string"},"dryRun":{"default":true,"description":"If true, only report what would be deleted without deleting","type":"boolean"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"limit":{"default":500,"description":"Maximum number of emails to check","type":"number"},"minConfidence":{"default":"high","description":"Minimum confidence level for spam detection","enum":["high","medium","low"],"type":"string"}},"required":["accountId"],"type":"object"},"name":"imap_delete_spam"},{"description":"Get statistics about sender domains in a folder. Useful for identifying bulk senders or spam patterns.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID","type":"string"},"folder":{"default":"INBOX","description":"Folder name","type":"string"},"limit":{"default":500,"description":"Maximum number of emails to analyze","type":"number"},"minCount":{"default":2,"description":"Minimum email count per domain to include","type":"number"}},"required":["accountId"],"type":"object"},"name":"imap_domain_stats"},{"description":"Add a domain to the custom spam list. Emails from this domain will be flagged as spam.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"domain":{"description":"Domain to add to spam list (e.g., \"spammer.com\")","type":"string"}},"required":["domain"],"type":"object"},"name":"imap_add_spam_domain"},{"description":"Remove a domain from the custom spam list.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"domain":{"description":"Domain to remove from spam list","type":"string"}},"required":["domain"],"type":"object"},"name":"imap_remove_spam_domain"},{"description":"Add a domain to the whitelist. Emails from whitelisted domains will never be flagged as spam.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"domain":{"description":"Domain to whitelist (e.g., \"trusted.com\")","type":"string"}},"required":["domain"],"type":"object"},"name":"imap_add_whitelist_domain"},{"description":"List all known spam domains (built-in and custom).","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{},"type":"object"},"name":"imap_list_spam_domains"},{"description":"Delete all emails from a specific domain. Useful for cleaning up unwanted newsletters or spam.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"accountId":{"description":"Account ID","type":"string"},"domain":{"description":"Domain to delete emails from (e.g., \"spammer.com\")","type":"string"},"dryRun":{"default":true,"description":"If true, only report what would be deleted","type":"boolean"},"folder":{"default":"INBOX","description":"Folder name","type":"string"}},"required":["accountId","domain"],"type":"object"},"name":"imap_delete_by_domain"}]}}}
