Skip to main content
Glama
Soundhannes

IMAP MCP Server

by Soundhannes

save_draft

Save email drafts with recipient, subject, and body, automatically adding configured signatures for later editing or sending.

Instructions

Save email as draft (automatically includes user signature from config)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient addresses
subjectYesEmail subject
bodyYesEmail body (plain text)
ccNoCC addresses
bccNoBCC addresses
htmlBodyNoEmail body (HTML, optional)
draftsFolderNoDrafts folder name (default: Drafts)
includeSignatureNoInclude signature from config (default: true)

Implementation Reference

  • The `save_draft` method in the IMAP client handles the logic of creating and saving an email draft to the configured IMAP drafts folder.
    def save_draft(
        self,
        to: list[str],
        subject: str,
        body: str,
        cc: Optional[list[str]] = None,
        bcc: Optional[list[str]] = None,
        html_body: Optional[str] = None,
        drafts_folder: str = "Drafts",
        include_signature: bool = True,
    ) -> bool:
        """Save email as draft."""
        self._ensure_connected()
    
        from email.mime.text import MIMEText
        from email.mime.multipart import MIMEMultipart
    
        # Append signature if enabled
        final_body = body
        final_html = html_body
    
        if include_signature:
            text_sig = self.get_signature("text")
            if text_sig:
                final_body = body + text_sig
    
            if html_body:
                html_sig = self.get_signature("html")
                if html_sig:
                    final_html = html_body + html_sig
    
        # Set From header from config
        user_config = self.config.get("user", {})
        from_name = user_config.get("name", "")
        from_email = user_config.get("email", self.config.get("credentials", {}).get("username", ""))
    
        if final_html:
            msg = MIMEMultipart("alternative")
            msg.attach(MIMEText(final_body, "plain"))
            msg.attach(MIMEText(final_html, "html"))
        else:
            msg = MIMEText(final_body)
    
        msg["To"] = ", ".join(to)
        msg["Subject"] = subject
        if from_name and from_email:
            msg["From"] = f"{from_name} <{from_email}>"
        elif from_email:
            msg["From"] = from_email
        if cc:
            msg["Cc"] = ", ".join(cc)
        if bcc:
            msg["Bcc"] = ", ".join(bcc)
        msg["Date"] = email.utils.formatdate(localtime=True)
    
        self.client.append(
            drafts_folder,
            msg.as_bytes(),
            flags=[b"\\Draft"],
        )
        return True
  • The tool `save_draft` is registered and routed in the `server.py` main handler logic.
    elif name == "save_draft":
        return imap_client.save_draft(
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions automatic signature inclusion, which adds some context, but fails to cover critical aspects like whether this is a mutation (implied by 'save'), permission requirements, rate limits, or what happens on failure (e.g., if the drafts folder doesn't exist). For a write operation with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Save email as draft') and adds a useful detail about signature inclusion. There is no wasted verbiage or redundancy, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (8 parameters, mutation operation) and lack of annotations or output schema, the description is moderately complete. It covers the basic purpose and a key behavioral trait (signature inclusion), but gaps remain in usage guidelines, full behavioral transparency, and output details. It's adequate but has clear room for improvement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 8 parameters. The description adds minimal value beyond the schema by hinting at signature behavior related to the 'includeSignature' parameter, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Save email as draft') and resource ('email'), distinguishing it from siblings like 'send_email' (not present) or 'archive_email' by focusing on draft creation. It adds unique detail about automatic signature inclusion from config.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives is provided. For example, it doesn't mention when to choose this over a 'send_email' tool (if available) or other email-related operations like 'archive_email' or 'move_email' from the sibling list. The description only states what it does, not when it's appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Soundhannes/IMAP-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server