get_rewrite
Retrieve detailed configuration for email rewrite rules in Migadu hosting. Specify a rule name to view its settings and domain associations.
Instructions
Get detailed rewrite rule configuration. Requires rule name/slug.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| domain | No |
Implementation Reference
- migadu_mcp/tools/rewrite_tools.py:60-92 (handler)The get_rewrite tool handler: registers the tool with @mcp.tool(), handles domain resolution, logging, error handling, and calls the rewrite service to fetch the rule details.@mcp.tool( annotations={ "readOnlyHint": True, "idempotentHint": True, "openWorldHint": True, }, ) async def get_rewrite( name: str, ctx: Context, domain: str | None = None ) -> Dict[str, Any]: """Get detailed rewrite rule configuration. Requires rule name/slug.""" 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: await log_operation_start( ctx, "Retrieving rewrite rule details", f"{name}@{domain}" ) service = get_service_factory().rewrite_service() result = await service.get_rewrite(domain, name) await log_operation_success( ctx, "Retrieved rewrite rule details", f"{name}@{domain}" ) return result except Exception as e: await log_operation_error(ctx, "Get rewrite", f"{name}@{domain}", str(e)) raise
- Core service method that executes the API request to retrieve the specific rewrite rule from Migadu.async def get_rewrite(self, domain: str, name: str) -> Dict[str, Any]: """Get details of a specific rewrite""" return await self.client.request("GET", f"/domains/{domain}/rewrites/{name}")
- migadu_mcp/main.py:24-24 (registration)Top-level registration call that invokes the tool registration function containing the get_rewrite tool definition.register_rewrite_tools(mcp)