Skip to main content
Glama
seayniclabs

Keel

by seayniclabs

whois_lookup

Look up WHOIS information for a domain to find registrant, registrar, and expiration details.

Instructions

WHOIS lookup for a domain using the system whois command.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes

Implementation Reference

  • The whois_lookup tool handler function. It calls the system 'whois' command via asyncio, parses common fields (registrar, creation_date, expiry_date, name_servers) from the output, and returns them in a dict along with the raw output. Uses sanitize_domain() for input validation.
    async def whois_lookup(domain: str) -> dict:
        """WHOIS lookup for a domain using the system ``whois`` command."""
        domain = sanitize_domain(domain)
    
        try:
            proc = await asyncio.create_subprocess_exec(
                "whois", domain,
                stdout=asyncio.subprocess.PIPE,
                stderr=asyncio.subprocess.PIPE,
            )
            stdout, stderr = await asyncio.wait_for(proc.communicate(), timeout=30)
        except FileNotFoundError:
            return {"error": "whois command not found — install it on the host system"}
        except asyncio.TimeoutError:
            return {"error": "whois lookup timed out"}
    
        output = stdout.decode(errors="replace")
    
        # Parse common fields.
        info: dict[str, str | None] = {
            "domain": domain,
            "registrar": None,
            "creation_date": None,
            "expiry_date": None,
            "name_servers": [],
        }
    
        for line in output.splitlines():
            lower = line.lower().strip()
            if lower.startswith("registrar:"):
                info["registrar"] = line.split(":", 1)[1].strip()
            elif lower.startswith("creation date:"):
                info["creation_date"] = line.split(":", 1)[1].strip()
            elif "expir" in lower and "date" in lower and ":" in line:
                info["expiry_date"] = line.split(":", 1)[1].strip()
            elif lower.startswith("name server:"):
                ns = line.split(":", 1)[1].strip()
                if ns:
                    info["name_servers"].append(ns)
    
        info["raw"] = output
        return info
  • sanitize_domain helper: strips whitespace, lowercases the domain, rejects shell metacharacters, and validates against a hostname regex pattern. Called by whois_lookup before executing the whois command.
    def sanitize_domain(domain: str) -> str:
        """Sanitize a domain name for DNS lookups.
    
        Strips whitespace, lowercases, and rejects shell metacharacters.
        Returns the cleaned domain.
        """
        domain = domain.strip().lower()
        if not domain:
            raise ValueError("Domain must not be empty")
    
        if _SHELL_META.search(domain):
            raise ValueError(f"Domain contains forbidden characters: {domain!r}")
    
        if not _HOSTNAME_RE.match(domain):
            raise ValueError(f"Invalid domain: {domain!r}")
    
        return domain
  • The FastMCP instance 'mcp' is created here. whois_lookup is registered via the @mcp.tool() decorator on line 366.
    mcp = FastMCP("sounding")
  • The @mcp.tool() decorator registers whois_lookup as an MCP tool. Comment indicates it's tool #9.
    # ---------------------------------------------------------------------------
    # 9. whois_lookup
    # ---------------------------------------------------------------------------
    
    @mcp.tool()
  • Test for whois_lookup: calls the function with 'google.com' and asserts the domain matches and raw or error is present in the result.
    # ── whois_lookup ───────────────────────────────────────────────────────────
    
    
    @pytest.mark.asyncio
    async def test_whois_shape():
        """whois_lookup should return the expected dict shape."""
        result = await whois_lookup("google.com")
        assert result["domain"] == "google.com"
        assert "raw" in result or "error" in result
Behavior2/5

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

With no annotations, the description should disclose behavioral traits such as system command dependency, potential rate limits, or error scenarios. It only mentions 'using the system `whois` command', implying availability but no further details.

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 a single, front-loaded sentence with no unnecessary words. Every part is relevant, making it highly efficient for quick comprehension.

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 (1 parameter, no output schema), the description is minimally adequate. However, it fails to mention return value format, error handling, or the fact that the underlying `whois` command may not be available on all systems, leaving gaps for an agent.

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%, and the description adds no additional meaning beyond the parameter name 'domain'. It does not specify expected format (e.g., FQDN, without protocol) or provide examples, failing to compensate for the schema's lack of description.

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

Purpose5/5

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

The description clearly states the action ('WHOIS lookup') and resource ('domain'), and distinguishes itself from sibling tools like dns_lookup or ping by its specific focus on WHOIS data. The mention of the system `whois` command adds context.

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 (e.g., dns_lookup for DNS records). The description does not include any conditions or exclusions that help an agent decide between this and similar tools.

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/seayniclabs/sounding'

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