Skip to content

Conversation

@williamjameshandley
Copy link
Contributor

@williamjameshandley williamjameshandley commented Sep 1, 2025

Summary

  • Adds body_file parameter to both compose() and send() tools
  • Removes the broken email styling system that couldn't actually influence message composition
  • Simplifies the codebase by removing unnecessary complexity

Why the styling system was removed

The email styling system was fundamentally flawed because:

  • LLMs compose the complete message content BEFORE calling any tools
  • The style guidelines couldn't retroactively influence already-written text
  • The system just added "Hello" and "Best regards" around pre-written content
  • All the configuration complexity provided near-zero actual benefit

What remains (the useful part)

The body_file parameter enables genuine workflows:

  • Loading previously saved email drafts
  • Working with emails exported from other tools
  • Integrating with any system that produces .eml files
  • Using pre-composed emails with Mutt's signatures and encryption

Implementation

  • body_file and body parameters are mutually exclusive
  • File format: RFC822 headers (To:, Subject:) followed by blank line and body
  • Both tools can parse headers from the file and use them if not overridden

Example Usage

# Send a pre-composed email
send(body_file="/path/to/draft.eml")

# Open in Mutt for review/editing with signatures
compose(body_file="/path/to/draft.eml")

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

williamjameshandley and others added 5 commits August 26, 2025 07:07
Implements MCP-idiomatic email style system that influences LLM behavior before tool invocation:

- Add email style configuration module with YAML config support
- Implement MCP prompts for professional, casual, and academic styles
- Enhance tool descriptions with dynamic style guidelines
- Add style discovery tool for available prompts
- Support XDG config directories and environment variables
- Include comprehensive test suite with 19 test cases
- Provide example configuration with 5 predefined styles

Users can customize email styles by placing config at:
- ~/.config/mcp-email/style.yml
- ~/.emailstyle.yml
- $EMAIL_STYLE_FILE environment variable

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Replace list indexing with next(iter(...), None) for more robust and
idiomatic default style fallback when configured style is missing.
Keep version 0.13.1 from feature branch as it includes new functionality.
Enable compose to accept pre-drafted emails from draft_email() tool,
allowing users to review and edit styled drafts in Mutt with signatures
and encryption support before sending.

- Add draft_file parameter to compose function
- Extract recipient from draft for status message
- Fix open() shadowing with builtins.open()
The email styling system was fundamentally flawed - LLMs compose message
content before calling tools, so style guidelines couldn't influence
the actual message composition. The system just added greetings/signoffs
around already-written text.

This commit:
- Removes the entire draft_email tool and style configuration system
- Adds body_file parameter to both send() and compose() tools
- Makes body and body_file mutually exclusive as intended
- Simplifies the codebase by removing unnecessary complexity

The body_file parameter is genuinely useful for:
- Loading pre-saved email drafts
- Working with emails exported from other tools
- Integrating with systems that produce .eml files
@williamjameshandley williamjameshandley changed the title feat: add user-customizable email styles for msmtp feat: add body_file parameter to email compose and send tools Sep 9, 2025
Keep version 0.13.1 from feature branch
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