Skip to main content
Glama
anhhung04

DNSDumpster MCP Server

by anhhung04

get_mx_records

Retrieve MX records to identify mail servers for a domain, enabling email configuration verification and troubleshooting.

Instructions

Get MX (mail) records for a domain.

Args: domain: The domain name to query (e.g., example.com) ctx: Request context

Returns: Formatted string containing MX records

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'get_mx_records' tool, registered via @mcp.tool() decorator. It fetches MX records for the given domain using DNSDumpsterClient, processes the results including IPs and ASN info, formats them into a readable string, and handles errors gracefully.
    @mcp.tool()
    async def get_mx_records(domain: str, ctx: Context) -> str:
        """Get MX (mail) records for a domain.
    
        Args:
            domain: The domain name to query (e.g., example.com)
            ctx: Request context
    
        Returns:
            Formatted string containing MX records
        """
        if not domain:
            return "Error: Domain is required"
    
        # Validate domain
        if not is_valid_domain(domain):
            return "Error: Invalid domain name format"
    
        try:
            api_key = os.environ.get("DNSDUMPSTER_API_KEY")
            if not api_key:
                return "Error: API key not configured. Set DNSDUMPSTER_API_KEY environment variable."
    
            client = DNSDumpsterClient(api_key)
    
            try:
                ctx.info(f"Querying MX records for {domain}")
                result = await client.get_dns_records(domain)
    
                if "mx" not in result or not result["mx"]:
                    return f"No MX records found for {domain}"
    
                output_lines = [f"MX Records for {domain}:"]
    
                for record in result["mx"]:
                    host = record.get("host", "")
                    priority = record.get("priority", "")
    
                    priority_str = f" (Priority: {priority})" if priority else ""
                    output_lines.append(f"\nHost: {host}{priority_str}")
    
                    for ip_info in record.get("ips", []):
                        ip = ip_info.get("ip", "")
                        country = ip_info.get("country", "Unknown")
                        asn = ip_info.get("asn", "")
                        asn_name = ip_info.get("asn_name", "")
    
                        output_lines.append(f"  IP: {ip}")
                        output_lines.append(f"  Country: {country}")
                        if asn:
                            output_lines.append(f"  ASN: {asn}")
                        if asn_name:
                            output_lines.append(f"  ASN Name: {asn_name}")
    
                return "\n".join(output_lines)
            finally:
                await client.close()
    
        except Exception as e:
            return f"Error: {str(e)}"
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the return format ('Formatted string containing MX records'), but lacks details on error handling, rate limits, authentication needs, or whether this is a read-only operation. The description does not contradict annotations, but provides minimal behavioral context.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded, with the purpose stated first. The 'Args' and 'Returns' sections are structured clearly, but the inclusion of 'ctx: Request context' (which is not in the schema) adds minor redundancy. Overall, it's efficient with minimal waste.

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 low complexity (one parameter) and the presence of an output schema, the description is somewhat complete but has gaps. It covers the basic purpose and parameter semantics, but lacks usage guidelines and sufficient behavioral transparency, especially with no annotations. The output schema reduces the need to explain return values in detail.

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

Parameters4/5

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

The description adds meaning beyond the input schema, which has 0% description coverage. It explains the 'domain' parameter with an example ('e.g., example.com') and clarifies that it's 'The domain name to query.' With only one parameter and no schema descriptions, this compensation is effective, though not exhaustive.

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 MX (mail) records for a domain.' It specifies the verb ('Get') and resource ('MX records'), but does not explicitly differentiate it from sibling tools like get_a_records or get_ns_records, which perform similar queries for different DNS record types.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description does not mention sibling tools or contexts where MX records are specifically needed over other DNS records, leaving the agent to infer usage based on the tool name alone.

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/anhhung04/mcp-dnsdumpster'

If you have feedback or need assistance with the MCP directory API, please join our Discord server