get_alias
Retrieve detailed configuration for a specific email alias in Migadu, including forwarding rules and domain settings, to manage email routing.
Instructions
Get detailed alias information.
Args: target: Local part of alias domain: Domain name. Uses MIGADU_DOMAIN if not provided.
Returns: JSON object with complete alias configuration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | ||
| domain | No |
Implementation Reference
- migadu_mcp/tools/alias_tools.py:75-105 (handler)The primary handler function for the 'get_alias' tool. It processes input parameters, resolves the domain if not provided, formats the email address, performs logging, calls the alias service to fetch the alias details, and returns the result.async def get_alias( target: str, ctx: Context, domain: str | None = None ) -> Dict[str, Any]: """Get detailed alias information. Args: target: Local part of alias domain: Domain name. Uses MIGADU_DOMAIN if not provided. Returns: JSON object with complete alias configuration """ 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") try: email_address = format_email_address(domain, target) await log_operation_start(ctx, "Retrieving alias details", email_address) service = get_service_factory().alias_service() result = await service.get_alias(domain, target) await log_operation_success(ctx, "Retrieved alias details", email_address) return result except Exception as e: await log_operation_error(ctx, "Get alias", f"{target}@{domain}", str(e)) raise
- migadu_mcp/main.py:23-23 (registration)The call to register_alias_tools(mcp) in the main initialization function, which triggers the definition and registration of the get_alias tool among others.register_alias_tools(mcp)
- Helper/service layer method that performs the actual API request to retrieve the specific alias information from the Migadu API.async def get_alias(self, domain: str, local_part: str) -> Dict[str, Any]: """Get details of a specific alias""" return await self.client.request( "GET", f"/domains/{domain}/aliases/{local_part}" )
- migadu_mcp/tools/alias_tools.py:68-74 (registration)The @mcp.tool() decorator applied to the get_alias function, which registers it as an MCP tool with specific annotations.@mcp.tool( annotations={ "readOnlyHint": True, "idempotentHint": True, "openWorldHint": True, }, )