Skip to main content
Glama
Michaelzag

Migadu MCP Server

by Michaelzag

delete_identity

DestructiveIdempotent

Remove email identities from Migadu hosting by specifying mailboxes and domains. This destructive action permanently deletes configured identities.

Instructions

Delete identities. DESTRUCTIVE: Cannot be undone. List of dicts with: target, mailbox (required), domain (optional).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetsYes

Implementation Reference

  • Main MCP tool handler for 'delete_identity', decorated with @mcp.tool(). Handles bulk deletion by calling process_delete_identity helper.
    @mcp.tool(
        annotations={
            "readOnlyHint": False,
            "destructiveHint": True,
            "idempotentHint": True,
            "openWorldHint": True,
        },
    )
    async def delete_identity(
        targets: List[Dict[str, Any]], ctx: Context
    ) -> Dict[str, Any]:
        """Delete identities. DESTRUCTIVE: Cannot be undone. List of dicts with: target, mailbox (required), domain (optional)."""
        count = len(list(ensure_iterable(targets)))
        await log_bulk_operation_start(ctx, "Deleting", count, "identity")
        await ctx.warning("🗑️ DESTRUCTIVE: This operation cannot be undone!")
    
        result = await process_delete_identity(targets, ctx)
        await log_bulk_operation_result(ctx, "Identity deletion", result, "identity")
        return result
  • Pydantic schema for input validation of delete_identity requests, used by bulk_processor_with_schema.
    class IdentityDeleteRequest(BaseModel):
        """Request schema for deleting an identity"""
    
        target: str = Field(..., description="Local part of identity address")
        mailbox: str = Field(..., description="Username of mailbox that owns this identity")
        domain: Optional[str] = Field(None, description="Domain name")
  • Helper function for processing individual validated delete requests, handles domain resolution, logging, and service call.
    @bulk_processor_with_schema(IdentityDeleteRequest)
    async def process_delete_identity(
        validated_item: IdentityDeleteRequest, ctx: Context
    ) -> Dict[str, Any]:
        """Process a single identity deletion"""
        # Get domain if not provided
        domain = validated_item.domain
        if domain is None:
            from migadu_mcp.config import get_config
    
            config = get_config()
            domain = config.get_default_domain()
            if not domain:
                raise ValueError("No domain provided and MIGADU_DOMAIN not configured")
    
        email_address = format_email_address(domain, validated_item.target)
        await ctx.warning(f"🗑️ DESTRUCTIVE: Deleting identity {email_address}")
    
        service = get_service_factory().identity_service()
        await service.delete_identity(
            domain, validated_item.mailbox, validated_item.target
        )
    
        await log_operation_success(ctx, "Deleted identity", email_address)
        return {"deleted": email_address, "success": True}
  • Service method that performs the actual HTTP DELETE request to Migadu API to delete the identity.
    async def delete_identity(
        self, domain: str, mailbox: str, identity: str
    ) -> Dict[str, Any]:
        """Delete an identity"""
        return await self.client.request(
            "DELETE", f"/domains/{domain}/mailboxes/{mailbox}/identities/{identity}"
        )
Behavior4/5

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

The description adds valuable behavioral context beyond what annotations provide. While annotations already declare destructiveHint=true, the description explicitly states 'DESTRUCTIVE: Cannot be undone' which reinforces this critical information. It also provides parameter structure guidance ('List of dicts with: target, mailbox (required), domain (optional)') that helps understand how to use the tool.

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 efficiently structured in just two sentences. The first states the purpose, the second provides critical warnings and parameter guidance. Every element serves a clear purpose with minimal waste, though the formatting could be slightly improved for readability.

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?

For a destructive operation with 0% schema coverage and no output schema, the description does reasonably well by explaining the parameter structure and emphasizing the irreversible nature. However, it lacks information about what happens after deletion (confirmation? error handling?), what 'identity' specifically means in this context, and how this differs from other deletion operations.

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?

With 0% schema description coverage, the description carries the full burden of explaining parameters. It successfully explains that the 'targets' parameter should be a list of dictionaries with specific fields (target, mailbox, domain), including which are required versus optional. This provides essential semantic information not available in the bare schema.

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

Purpose4/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 resource 'identities', making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'delete_alias', 'delete_mailbox', or 'delete_rewrite' which also perform deletion operations on different resources.

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?

The description provides no guidance on when to use this tool versus alternatives like 'delete_alias' or 'delete_mailbox'. While it mentions the destructive nature, it doesn't explain when identity deletion is appropriate versus other deletion operations or what prerequisites might be required.

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