get_forwarding
Retrieve details about a specific email forwarding including its confirmation status, expiry date, and active state.
Instructions
Get details for a specific forwarding (confirmation status, expiry, active state).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mailbox | Yes | ||
| address | Yes | ||
| domain | No |
Implementation Reference
- Executes the HTTP GET to the Migadu API to fetch a specific forwarding by its address (URL-encoded). This is the core service-layer logic invoked by the tool handler.
async def get_forwarding( self, domain: str, mailbox: str, address: str ) -> dict[str, Any]: return await self.client.get( f"/domains/{domain}/mailboxes/{mailbox}/forwardings/{_encode_address(address)}" ) - The MCP tool handler for 'get_forwarding'. Decorated with @migadu_tool(mcp, read_only=True), it resolves the domain, logs the request, and delegates to ForwardingService.get_forwarding.
@migadu_tool(mcp, read_only=True) async def get_forwarding( mailbox: str, address: str, ctx: Context, domain: str | None = None ) -> dict[str, Any]: """Get details for a specific forwarding (confirmation status, expiry, active state).""" resolved = resolve_domain(domain) await ctx.info(f"📋 Getting forwarding {address} on {mailbox}@{resolved}") return ( await get_service_factory() .forwarding_service() .get_forwarding(resolved, mailbox, address) ) - migadu_mcp/tools/forwarding_tools.py:16-16 (registration)The register_forwarding_tools function is called from main.py to register all forwarding tools including get_forwarding on the FastMCP server.
def register_forwarding_tools(mcp: FastMCP) -> None: - migadu_mcp/main.py:51-57 (registration)initialize_server() calls register_forwarding_tools(mcp), registering the get_forwarding tool on the MCP server.
def initialize_server() -> None: register_domain_tools(mcp) register_mailbox_tools(mcp) register_identity_tools(mcp) register_alias_tools(mcp) register_rewrite_tools(mcp) register_forwarding_tools(mcp) - Helper function that URL-encodes the forwarding address for use in the API path.
def _encode_address(address: str) -> str: return quote(address, safe="")