Skip to main content
Glama

whois_lookup_by_ip

Retrieve WHOIS records for any IP address or range to identify ownership, registration details, and network information from authoritative sources like ARIN and RIPE.

Instructions

WHOIS lookup by IP address or IP range.

Args: ip: IP address or range to lookup page: Page number for paginated results source: Filter by WHOIS source (arin, ripe, afrinic, apnic, lacnic)

Returns: WHOIS records for the IP or range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes
pageNo
sourceNo

Implementation Reference

  • The @mcp.tool()-decorated handler function implementing the core logic of the whois_lookup_by_ip tool, including client retrieval, parameter conversion, API call, and error handling.
    @mcp.tool() async def whois_lookup_by_ip( ip: str, ctx: Context[Any, Any, Any], page: int | None = None, source: str | None = None ) -> dict[str, Any]: """WHOIS lookup by IP address or IP range. Args: ip: IP address or range to lookup page: Page number for paginated results source: Filter by WHOIS source (arin, ripe, afrinic, apnic, lacnic) Returns: WHOIS records for the IP or range. """ client = get_client(ctx) whois_source = WhoisSource(source) if source else None try: result = await client.get_whois_net_by_ip(ip, page, whois_source) return result.model_dump(exclude_none=True) except IPInfoAPIError as e: ctx.error(f"API error: {e.message}") raise
  • Supporting method in IPInfoClient that performs the HTTP GET request to the IPInfo WHOIS/net/{ip} endpoint and parses the response into WhoisIpResponse model.
    async def get_whois_net_by_ip( self, ip: str, page: int | None = None, source: WhoisSource | None = None ) -> WhoisIpResponse: """Get WHOIS information by IP or IP range.""" 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/{ip}", params=params or None) return WhoisIpResponse(**data)
  • Pydantic model defining the output schema for WHOIS IP lookup responses, used by the client and returned (as dict) by the tool.
    class WhoisIpResponse(BaseModel): net: str | None = None total: int | None = None page: int | None = None records: list[WhoisRecord] | None = None
  • Pydantic model for individual WHOIS records contained within the WhoisIpResponse.
    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
  • Enum defining valid WHOIS sources used for filtering in the tool parameters and API requests.
    class WhoisSource(str, Enum): ARIN = "arin" RIPE = "ripe" AFRINIC = "afrinic" APNIC = "apnic" LACNIC = "lacnic"

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/NimbleBrainInc/mcp-ipinfo'

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