feat(gmail): Add flexible attachment support to send_gmail_message#252
Open
loserbcc wants to merge 1 commit intotaylorwilsdon:mainfrom
Open
feat(gmail): Add flexible attachment support to send_gmail_message#252loserbcc wants to merge 1 commit intotaylorwilsdon:mainfrom
loserbcc wants to merge 1 commit intotaylorwilsdon:mainfrom
Conversation
Adds dual-mode attachment support to send_gmail_message function: - Local file path attachments using multipart MIME - Public URL attachments embedded as HTML links Features: - Auto-detects MIME types for file attachments - Base64 encoding for binary files - Graceful error handling (logs warnings, continues on failure) - Backward compatible (all new parameters optional) - Comprehensive documentation with usage examples Implementation: - New helper: _prepare_gmail_message_with_file_attachments() - New helper: _prepare_gmail_message_with_url_attachments() - Enhanced: _prepare_gmail_message() routing logic - Updated: send_gmail_message() signature and docstring - Added imports: os, mimetypes, MIMEMultipart, MIMEBase, encoders Tests: All 3 automated tests passed - Local file attachments (multipart MIME) - Public URL attachments (HTML links) - Error handling (missing files) ~250 lines added with comprehensive docstrings and examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Quick question whats the difference between this PR and #237 |
Repository owner
deleted a comment from
kapilthakare-cyberpunk
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds flexible attachment support to the Gmail
send_gmail_messagetool with two modes of operation:Motivation
Email without attachment support is significantly limited. This feature fills a critical gap in the Google Workspace MCP Gmail functionality, making it feature-complete for email operations.
Related PRs
These PRs work together to enable:
user_google_email(PR Fix: Gmail send_message now respects user_google_email for From header #249)Changes
attachmentsparameter:Optional[List[str]]for file paths or URLsuse_public_linksparameter:boolto switch between modes_prepare_gmail_message_with_file_attachments()(~130 lines)_prepare_gmail_message_with_url_attachments()(~100 lines)_prepare_gmail_message()with routing logicFeatures
✅ Auto-detects MIME types from file extensions
✅ Base64 encoding for binary files
✅ Graceful error handling (missing files logged, not fatal)
✅ Backward compatible (existing code unchanged)
✅ Well documented with examples
✅ Supports multiple attachments
✅ Works with threading/replies
✅ Integrates with multi-user credential system (PR #253)
Usage Examples
Local file attachments:
Public URL attachments:
Testing
Breaking Changes
None - all new parameters are optional with sensible defaults.
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]