Skip to main content
Glama
Michaelzag

Migadu MCP Server

by Michaelzag

get_rewrite

Read-onlyIdempotent

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)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, openWorldHint=true, and idempotentHint=true, so the agent knows this is a safe, read-only, idempotent operation that may return partial data. The description adds context about requiring a rule name/slug, which is useful but doesn't disclose additional behavioral traits like error handling, rate limits, or authentication needs. No contradiction with annotations exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded: a single sentence that directly states the purpose and key requirement. Every word earns its place with no redundancy or fluff, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple read operation with 2 parameters), annotations cover safety and idempotency well, and there's no output schema. The description is minimal but addresses the core purpose. However, with 0% schema coverage and incomplete parameter semantics, it lacks details on the 'domain' parameter and return values, making it only adequate for basic use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions 'rule name/slug' for the 'name' parameter, adding some meaning, but doesn't explain the 'domain' parameter at all. With 2 parameters and low coverage, the description partially compensates but leaves one parameter undocumented, falling short of adequate compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get detailed rewrite rule configuration' specifies the verb (get) and resource (rewrite rule configuration). It distinguishes from siblings like 'list_rewrites' (which likely lists multiple rules) by focusing on retrieving detailed configuration for a specific rule. However, it doesn't explicitly contrast with 'update_rewrite' or 'delete_rewrite' beyond the verb difference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance by stating 'Requires rule name/slug,' indicating this is for retrieving specific rules rather than listing all. It distinguishes from 'list_rewrites' by this requirement. However, it doesn't explicitly state when to use this versus alternatives like 'get_alias' or 'get_mailbox,' nor does it provide exclusions or prerequisites beyond the parameter requirement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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