get_alias
Retrieve detailed configuration of an email alias by specifying its local part and domain. Returns a JSON object with complete alias settings for Migadu email hosting.
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
| Name | Required | Description | Default |
|---|---|---|---|
| domain | No | ||
| target | Yes |
Input Schema (JSON Schema)
{
"properties": {
"domain": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Domain"
},
"target": {
"title": "Target",
"type": "string"
}
},
"required": [
"target"
],
"type": "object"
}
Implementation Reference
- migadu_mcp/tools/alias_tools.py:69-105 (handler)MCP tool handler for get_alias: retrieves detailed information about a specific email alias by calling the alias service. Includes decorators indicating it's read-only and idempotent.annotations={ "readOnlyHint": True, "idempotentHint": True, "openWorldHint": True, }, ) 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)Registers the alias tools module (including get_alias) by calling register_alias_tools(mcp) during server initialization.register_alias_tools(mcp)
- Service layer helper method that performs the actual Migadu API GET request to retrieve alias details.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/utils/schemas.py:356-364 (schema)Pydantic schema defining the expected structure of alias response data, matching the tool's return type.class AliasResponse(BaseModel): """Response schema for alias operations""" address: str local_part: str domain_name: str is_internal: bool destinations: List[EmailStr]