whois_lookup_by_domain
Retrieve WHOIS records for any domain to identify ownership details, registration information, and contact data using IPInfo's database.
Instructions
WHOIS lookup by organization domain.
Args: domain: Domain name to lookup page: Page number for paginated results source: Filter by WHOIS source (arin, ripe, afrinic, apnic, lacnic)
Returns: WHOIS records for the domain.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | ||
| page | No | ||
| source | No |
Implementation Reference
- src/mcp_ipinfo/server.py:321-342 (handler)The primary handler function decorated with @mcp.tool(), which registers and executes the whois_lookup_by_domain tool. It invokes the IPInfoClient to fetch WHOIS data by domain.@mcp.tool() async def whois_lookup_by_domain( domain: str, ctx: Context[Any, Any, Any], page: int | None = None, source: str | None = None ) -> dict[str, Any]: """WHOIS lookup by organization domain. Args: domain: Domain name to lookup page: Page number for paginated results source: Filter by WHOIS source (arin, ripe, afrinic, apnic, lacnic) Returns: WHOIS records for the domain. """ client = get_client(ctx) whois_source = WhoisSource(source) if source else None try: result = await client.get_whois_net_by_domain(domain, page, whois_source) return result.model_dump(exclude_none=True) except IPInfoAPIError as e: ctx.error(f"API error: {e.message}") raise
- src/mcp_ipinfo/api_models.py:109-144 (schema)Pydantic models defining the output structure: WhoisDomainResponse for the response container and WhoisRecord for individual records.class WhoisRecord(BaseModel): range: str | None = None id: str | None = None name: str | None = None country: str | None = None org: str | None = None admin: Any | None = None abuse: Any | None = None tech: Any | None = None maintainer: Any | None = None updated: str | None = None status: str | None = None source: str | None = None raw: str | None = None domain: str | None = None class WhoisNetIdResponse(BaseModel): net: str | None = None total: int | None = None page: int | None = None records: list[WhoisRecord] | None = None class WhoisIpResponse(BaseModel): net: str | None = None total: int | None = None page: int | None = None records: list[WhoisRecord] | None = None class WhoisDomainResponse(BaseModel): net: str | None = None total: int | None = None page: int | None = None records: list[WhoisRecord] | None = None
- src/mcp_ipinfo/api_models.py:15-20 (schema)Enum for the optional 'source' input parameter to filter WHOIS records by regional registry.class WhoisSource(str, Enum): ARIN = "arin" RIPE = "ripe" AFRINIC = "afrinic" APNIC = "apnic" LACNIC = "lacnic"
- src/mcp_ipinfo/api_client.py:264-275 (helper)Supporting method in IPInfoClient that makes the HTTP GET request to the IPInfo WHOIS API endpoint for domain-based lookups and parses the response into the WhoisDomainResponse model.async def get_whois_net_by_domain( self, domain: str, page: int | None = None, source: WhoisSource | None = None ) -> WhoisDomainResponse: """Get WHOIS information by domain.""" params: dict[str, Any] = {} if page is not None: params["page"] = page if source: params["source"] = source.value data = await self._request("GET", f"/whois/net/{domain}", params=params or None) return WhoisDomainResponse(**data)