get_abuse_contact
Look up abuse contact information for any IP address to report malicious activity. Returns email, phone, and address details for responsible parties.
Instructions
Get abuse contact information for an IP address.
Args: ip: IP address to lookup
Returns: Abuse contact details including email, phone, and address.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ip | Yes |
Implementation Reference
- src/mcp_ipinfo/server.py:276-292 (handler)The MCP tool handler function for 'get_abuse_contact'. It uses the @mcp.tool() decorator for registration and delegates to the IPInfoClient.get_abuse() method.@mcp.tool() async def get_abuse_contact(ip: str, ctx: Context[Any, Any, Any]) -> AbuseResponse: """Get abuse contact information for an IP address. Args: ip: IP address to lookup Returns: Abuse contact details including email, phone, and address. """ client = get_client(ctx) try: return await client.get_abuse(ip) except IPInfoAPIError as e: ctx.error(f"API error: {e.message}") raise
- src/mcp_ipinfo/api_models.py:68-75 (schema)Pydantic BaseModel defining the structure of the AbuseResponse returned by the tool.class AbuseResponse(BaseModel): address: str | None = Field(None, description="Address") country: str | None = Field(None, description="Country") email: str | None = Field(None, description="Email") name: str | None = Field(None, description="Name") network: str | None = Field(None, description="Network") phone: str | None = Field(None, description="Phone")
- src/mcp_ipinfo/api_client.py:224-228 (helper)Helper method in IPInfoClient that makes the HTTP request to the IPInfo API /abuse endpoint and parses the response into AbuseResponse.async def get_abuse(self, ip: str) -> AbuseResponse: """Get abuse contact information for an IP.""" data = await self._request("GET", f"/{ip}/abuse") return AbuseResponse(**data)
- src/mcp_ipinfo/server.py:29-38 (helper)Utility function to lazily initialize and retrieve the shared IPInfoClient instance used by all tools including get_abuse_contact.def get_client(ctx: Context[Any, Any, Any]) -> IPInfoClient: """Get or create the API client instance.""" global _client if _client is None: api_token = os.environ.get("IPINFO_API_TOKEN") if not api_token: ctx.warning("IPINFO_API_TOKEN is not set - some features may be limited") _client = IPInfoClient(api_token=api_token) return _client