Skip to main content
Glama
Michaelzag
by Michaelzag

get_rewrite

Retrieve detailed configuration of rewrite rules for email domains using the rule name/slug. Essential for managing email routing and automation in Migadu MCP Server.

Instructions

Get detailed rewrite rule configuration. Requires rule name/slug.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainNo
nameYes

Implementation Reference

  • The primary handler function implementing the logic for the 'get_rewrite' MCP tool, including parameter handling, logging, service delegation, and error management.
    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
  • The call to register_rewrite_tools which registers the 'get_rewrite' tool (and other rewrite tools) with the FastMCP instance.
    register_rewrite_tools(mcp)
  • Helper service method that performs the actual Migadu API request to fetch the rewrite rule details.
    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}")
  • The @mcp.tool decorator that registers the get_rewrite function as an MCP tool.
    @mcp.tool( annotations={ "readOnlyHint": True, "idempotentHint": True, "openWorldHint": True, }, )
  • The specific call to the rewrite service's get_rewrite method within the tool handler.
    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

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