Skip to main content
Glama
Michaelzag

Migadu MCP Server

by Michaelzag

delete_mailbox

DestructiveIdempotent

Remove email mailboxes from Migadu hosting services. This destructive action permanently deletes specified mailboxes and cannot be reversed.

Instructions

Delete mailboxes. DESTRUCTIVE: Cannot be undone. List of dicts with: target (email/local).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetsYes

Implementation Reference

  • Main handler for the 'delete_mailbox' tool. Registers the tool with FastMCP and orchestrates bulk deletion by calling the process_delete_mailbox helper.
    @mcp.tool(
        annotations={
            "readOnlyHint": False,
            "destructiveHint": True,
            "idempotentHint": True,
            "openWorldHint": True,
        },
    )
    async def delete_mailbox(
        targets: List[Dict[str, Any]], ctx: Context
    ) -> Dict[str, Any]:
        """Delete mailboxes. DESTRUCTIVE: Cannot be undone. List of dicts with: target (email/local)."""
        count = len(list(ensure_iterable(targets)))
        await log_bulk_operation_start(ctx, "Deleting", count, "mailbox")
        await ctx.warning("🗑️ DESTRUCTIVE: This operation cannot be undone!")
    
        result = await process_delete_mailbox(targets, ctx)
        await log_bulk_operation_result(ctx, "Mailbox deletion", result, "mailbox")
        return result
  • Helper function that processes individual mailbox deletion: validates input, parses email target, calls MailboxService.delete_mailbox, and logs the operation.
    @bulk_processor_with_schema(MailboxDeleteRequest)
    async def process_delete_mailbox(
        validated_item: MailboxDeleteRequest, ctx: Context
    ) -> Dict[str, Any]:
        """Process a single mailbox deletion with Pydantic validation"""
        # Use validated Pydantic model directly - all validation already done
        target = validated_item.target
    
        # Parse target
        parsed = parse_email_target(target)
        domain, local_part = parsed[0]
        email_address = format_email_address(domain, local_part)
    
        await ctx.warning(f"🗑️ DESTRUCTIVE: Deleting mailbox {email_address}")
    
        service = get_service_factory().mailbox_service()
        await service.delete_mailbox(domain, local_part)
    
        await log_operation_success(ctx, "Deleted mailbox", email_address)
        return {"deleted": email_address, "success": True}
  • Pydantic model used for input validation of delete_mailbox requests, requiring a 'target' field (email or local part).
    class MailboxDeleteRequest(BaseModel):
        """Request schema for deleting a mailbox"""
    
        target: str = Field(..., description="Email address or local part")
  • Service layer method that executes the actual Migadu API DELETE request to remove the mailbox.
    async def delete_mailbox(self, domain: str, local_part: str) -> Dict[str, Any]:
        """Permanently delete a mailbox and all stored messages with API bug handling.
    
        Note: Due to Migadu API bug, successful deletions may return HTTP 500 errors.
        The operation actually succeeds despite the error response.
        """
        return await self.client.request(
            "DELETE", f"/domains/{domain}/mailboxes/{local_part}"
        )
  • Registration of mailbox tools (including delete_mailbox) by calling register_mailbox_tools on the FastMCP instance in the main server initialization.
    from migadu_mcp.tools.mailbox_tools import register_mailbox_tools
    from migadu_mcp.tools.identity_tools import register_identity_tools
    from migadu_mcp.tools.alias_tools import register_alias_tools
    from migadu_mcp.tools.rewrite_tools import register_rewrite_tools
    from migadu_mcp.tools.resource_tools import register_resources
    
    
    # Initialize FastMCP server
    mcp: FastMCP = FastMCP("Migadu Mailbox Manager")
    
    
    def initialize_server():
        """Initialize the MCP server with all tools and resources"""
        # Register all tools
        register_mailbox_tools(mcp)
Behavior4/5

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

Annotations already indicate destructiveHint=true, readOnlyHint=false, openWorldHint=true, and idempotentHint=true. The description adds value by explicitly warning 'DESTROYED: Cannot be undone', reinforcing the destructive nature, and specifying the input format ('List of dicts with: target (email/local)'), which provides practical context beyond the annotations. No contradiction with annotations is present.

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

Conciseness4/5

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

The description is concise with two sentences that efficiently convey key information: the action, a critical warning, and parameter details. It is front-loaded with the main purpose, though the parameter explanation could be slightly more structured for clarity.

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 destructive nature, no output schema, and 0% schema description coverage, the description is somewhat complete but has gaps. It covers the purpose, a warning, and parameter semantics, but lacks details on error handling, return values, or specific usage scenarios, which could hinder an agent's ability to invoke it correctly in all contexts.

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

Parameters4/5

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

Schema description coverage is 0%, so the description carries the full burden. It clarifies that the 'targets' parameter is a 'List of dicts with: target (email/local)', adding essential semantics about the structure and content of the parameter, which compensates well for the lack of schema descriptions. However, it does not detail all possible properties or constraints beyond 'target'.

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 verb 'Delete' and the resource 'mailboxes', making the purpose specific and unambiguous. It distinguishes itself from sibling tools like 'delete_alias' or 'delete_identity' by specifying the exact resource type, avoiding confusion.

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

Usage Guidelines3/5

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

The description provides implied usage guidance by warning 'DESTRUCTIVE: Cannot be undone', which suggests caution. However, it does not explicitly state when to use this tool versus alternatives like 'reset_mailbox_password' or 'update_mailbox', nor does it mention prerequisites or exclusions, leaving gaps in decision-making context.

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/Michaelzag/migadu-mcp'

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