Skip to content

feat: add archive_emails MCP tool#103

Closed
jkp wants to merge 4 commits intoai-zerolab:mainfrom
jkp:feat/archive-emails
Closed

feat: add archive_emails MCP tool#103
jkp wants to merge 4 commits intoai-zerolab:mainfrom
jkp:feat/archive-emails

Conversation

@jkp
Copy link

@jkp jkp commented Jan 17, 2026

Summary

  • Add archive_emails MCP tool to move emails to the Archive folder
  • Auto-discovers Archive folder via IMAP \Archive flag
  • Falls back to common folder names: Archive, INBOX.Archive, Archives, [Gmail]/All Mail
  • Uses IMAP COPY + DELETE + EXPUNGE pattern for reliable moves

Test plan

  • Unit tests for ClassicEmailHandler.archive_emails()
  • Unit tests for EmailClient.move_to_archive()
  • MCP tool integration tests
  • Manual testing with live email account

🤖 Generated with Claude Code

Jamie Kirkpatrick and others added 2 commits January 17, 2026 08:07
Add functionality to archive emails by moving them to the Archive folder.

- Add ArchiveEmailResponse model
- Implement archive folder discovery via \Archive IMAP flag
- Implement move_to_archive with fallback folder candidates:
  Archive, INBOX.Archive, Archives, [Gmail]/All Mail
- Add archive_emails abstract method to EmailHandler
- Add archive_emails MCP tool definition
- Add comprehensive tests for handler and MCP tool

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Jan 17, 2026

Codecov Report

❌ Patch coverage is 92.10526% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mcp_email_server/emails/classic.py 90.9% 5 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Jamie Kirkpatrick and others added 2 commits January 17, 2026 11:04
Tests for EmailClient archive methods:
- _find_archive_folder_by_flag: success, spaces, Gmail-style, not found, error handling
- move_to_archive: success, failures, no folder, flag-detected folder, custom mailbox

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Wh1isper
Copy link
Member

I don't think we need this tool... Close for now.

Welcome to raise an issue!

@Wh1isper Wh1isper closed this Jan 19, 2026
@jkp
Copy link
Author

jkp commented Jan 20, 2026

Is there another way to archive an email?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants