feat(gmail): Add flexible attachment support to send_gmail_message #252
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]