When creating Gmail drafts with attachments whose filenames contain
non-ASCII characters (e.g. umlauts like ü, ö, ä), Gmail displays
"noname" instead of the actual filename.
The root cause is that Content-Disposition was built via string
formatting (f'attachment; filename="{safe_filename}"'), which embeds
raw non-ASCII bytes in the header. Gmail cannot parse these and falls
back to "noname".
Fix: pass the filename as a keyword argument to add_header(), which
makes Python's email library automatically apply RFC 2231 encoding
(filename*=utf-8''...) for non-ASCII names while keeping ASCII
filenames unchanged.
Fixes#500
Fixes#327
- Use absolute path (~/.workspace-mcp/attachments/) instead of relative
./tmp/attachments to avoid polluting working directories
- Make storage directory configurable via WORKSPACE_ATTACHMENT_DIR env var
- Return file path from save_attachment() instead of UUID for direct
filesystem access (useful in stdio mode where HTTP URLs are unavailable)
- Preserve original filenames with UUID suffix for uniqueness
- Use format="full" instead of format="metadata" when fetching attachment
info, as metadata format doesn't include attachmentId in parts
- Add multi-level filename matching: exact attachmentId → size-based
fallback → single-attachment fallback (handles ephemeral IDs)
- Add file path and base64 content attachment support
- Auto-detect MIME types from file extensions
- Support attachments in both send_gmail_message and draft_gmail_message
- Accept attachments via 'path' (file path) or 'content' (base64) + 'filename'
- Note: FastMCP schema generation issue prevents List[Dict] from appearing in MCP tool schema
- Add optional from_email parameter to send_gmail_message
- Add optional from_email parameter to draft_gmail_message
- Allows sending/drafting from configured Gmail Send As aliases
- Falls back to authenticated user email if not specified
- Requires Send As alias to be configured in Gmail settings (Settings > Accounts > Send mail as)
- Updated docstrings with new parameter documentation and examples
This enables users to send emails from different email addresses configured
in their Gmail "Send mail as" settings, which is useful for users who manage
multiple email identities through a single Gmail account.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add optional from_name parameter to send_gmail_message and draft_gmail_message
functions. When provided, the From header is formatted as "Name <email>" instead
of just the email address.
This allows users to include their display name in sent emails, matching the
behaviour of composing emails directly in Gmail.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update 'GMAIL_METADATA_HEADERS' to include 'Date'.
- Update 'get_gmail_message_content' to display the 'Date' field.
- Update 'get_gmail_messages_content_batch' to display the 'Date' field in both metadata and full formats.
- Update docstrings to include 'Date' and 'Message-ID' in Returns description.
- Add missing parentheses to .execute() method call
- Remove redundant pass statement after logger.debug
- Keep urlsafe_b64decode() for consistency with codebase convention
Note: Copilot suggested using b64decode() instead of urlsafe_b64decode(),
but the codebase consistently uses urlsafe_b64decode() for Gmail message
body data (lines 72, 87 in gmail_tools.py). We follow the existing
codebase convention for consistency.