Skip to main content
Glama
Michaelzag

Migadu MCP Server

by Michaelzag

create_alias

Create email aliases with forwarding to manage email routing and organization for Migadu hosting services.

Instructions

Create email aliases with forwarding. List of dicts with: target (local part), destinations (email list), domain (optional), is_internal (optional).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasesYes

Implementation Reference

  • The main MCP tool handler function for 'create_alias'. It handles a list of alias configurations, logs the operation, delegates to process_create_alias for bulk processing, and returns the result.
    @mcp.tool(
        annotations={
            "readOnlyHint": False,
            "destructiveHint": False,
            "idempotentHint": False,
            "openWorldHint": True,
        },
    )
    async def create_alias(
        aliases: List[Dict[str, Any]], ctx: Context
    ) -> Dict[str, Any]:
        """Create email aliases with forwarding. List of dicts with: target (local part), destinations (email list), domain (optional), is_internal (optional)."""
        count = len(list(ensure_iterable(aliases)))
        await log_bulk_operation_start(ctx, "Creating", count, "alias")
    
        result = await process_create_alias(aliases, ctx)
        await log_bulk_operation_result(ctx, "Alias creation", result, "alias")
        return result
  • Pydantic schema for validating individual alias creation requests. Used by @bulk_processor_with_schema decorator on process_create_alias.
    class AliasCreateRequest(BaseModel):
        """Request schema for creating an alias"""
    
        target: str = Field(..., description="Local part of alias")
        destinations: Union[List[EmailStr], str] = Field(
            ..., description="List of email addresses or CSV string"
        )
        domain: Optional[str] = Field(None, description="Domain name")
        is_internal: bool = Field(False, description="Internal-only flag")
    
        @field_validator("destinations", mode="before")
        @classmethod
        def normalize_destinations(cls, v: Union[List[str], str]) -> List[str]:
            return normalize_destinations(v)
  • Registration call to register_alias_tools(mcp), which defines and registers the create_alias tool among others.
    register_alias_tools(mcp)
  • Helper function decorated with bulk_processor_with_schema that processes a single validated alias creation request and calls the service layer.
    @bulk_processor_with_schema(AliasCreateRequest)
    async def process_create_alias(
        validated_item: AliasCreateRequest, ctx: Context
    ) -> Dict[str, Any]:
        """Process a single alias creation with Pydantic validation"""
        # Use validated Pydantic model directly - all validation already done
        target = validated_item.target
        destinations = validated_item.destinations
        domain = validated_item.domain
        is_internal = validated_item.is_internal
    
        # Get domain if not provided
        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, target)
        await log_operation_start(
            ctx, "Creating alias", f"{email_address} -> {', '.join(destinations)}"
        )
    
        service = get_service_factory().alias_service()
        # Convert List[EmailStr] to List[str] for service layer
        destinations_str = [str(dest) for dest in destinations]
        result = await service.create_alias(
            domain, target, destinations_str, is_internal
        )
    
        await log_operation_success(ctx, "Created alias", email_address)
        if is_internal:
            await ctx.info("🔒 Configured as internal-only alias")
    
        return {"alias": result, "email_address": email_address, "success": True}
  • Core service implementation that performs the actual API POST request to create an alias in Migadu.
    async def create_alias(
        self,
        domain: str,
        local_part: str,
        destinations: List[str],
        is_internal: bool = False,
    ) -> Dict[str, Any]:
        """Create a new alias"""
        data = {
            "local_part": local_part,
            "destinations": ",".join(destinations),
            "is_internal": is_internal,
        }
        return await self.client.request(
            "POST", f"/domains/{domain}/aliases", json=data
        )
Behavior3/5

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

Annotations indicate this is a non-readOnly, non-destructive, non-idempotent, open-world operation. The description adds context by specifying 'with forwarding' and listing parameter fields, which clarifies the tool's behavior beyond annotations. However, it doesn't detail error handling, rate limits, or auth needs, leaving some behavioral aspects uncovered.

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, dense sentence that front-loads the purpose and efficiently lists parameter details without waste. Every word contributes to understanding the tool's function and inputs, making it highly concise and well-structured for quick comprehension.

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

Completeness4/5

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

Given the complexity of a creation tool with 1 parameter but 0% schema coverage and no output schema, the description is nearly complete. It explains the purpose and parameter semantics thoroughly. However, it lacks details on return values or error cases, which would be beneficial since there's no output schema, slightly reducing completeness.

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

Parameters5/5

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

With 0% schema description coverage and no output schema, the description fully compensates by detailing the parameter structure: 'List of dicts with: target (local part), destinations (email list), domain (optional), is_internal (optional).' This adds essential meaning beyond the bare schema, defining the expected format and optional fields clearly.

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 'Create' and resource 'email aliases with forwarding', which is specific and actionable. It distinguishes from siblings like 'create_mailbox' or 'create_identity' by focusing on aliases, though it doesn't explicitly contrast them. The purpose is well-defined but lacks explicit sibling differentiation.

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 'update_alias' or 'create_mailbox', nor does it mention prerequisites or context. It implies usage for creating aliases but offers no explicit when/when-not instructions or named alternatives, leaving the agent to infer from sibling tool names alone.

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