batch_lookup
Retrieve geolocation and network data for multiple IP addresses simultaneously using IPInfo's API to analyze IP intelligence in bulk operations.
Instructions
Batch lookup multiple IP addresses.
Args: ips: List of IP addresses to lookup (can include field paths like "8.8.8.8/city")
Returns: Dictionary with IP information for each address.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ips | Yes |
Implementation Reference
- src/mcp_ipinfo/server.py:87-102 (handler)The primary handler function for the 'batch_lookup' MCP tool. It is registered via the @mcp.tool() decorator and implements the tool logic by invoking the IPInfoClient's batch method.@mcp.tool() async def batch_lookup(ips: list[str], ctx: Context[Any, Any, Any]) -> dict[str, Any]: """Batch lookup multiple IP addresses. Args: ips: List of IP addresses to lookup (can include field paths like "8.8.8.8/city") Returns: Dictionary with IP information for each address. """ client = get_client(ctx) try: return await client.batch(ips) except IPInfoAPIError as e: ctx.error(f"API error: {e.message}") raise
- src/mcp_ipinfo/api_client.py:160-163 (helper)The supporting helper method in IPInfoClient that performs the actual batch API request to ipinfo.io/batch endpoint, called by the tool handler.async def batch(self, ips: list[str]) -> dict[str, Any]: """Batch lookup multiple IP addresses.""" data = await self._request("POST", "/batch", json_data=ips) return data