Skip to main content
Glama
Michaelzag
by Michaelzag

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
NameRequiredDescriptionDefault
nameYes
domainNo

Implementation Reference

  • 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}")
  • Top-level registration call that invokes the tool registration function containing the get_rewrite tool definition.
    register_rewrite_tools(mcp)

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