map_ips
Generate a visual map showing the geographic locations of IP addresses. Input a list of IPs to receive a map report with a visualization URL for spatial analysis.
Instructions
Create a visual map of IP address locations.
Args: ips: List of IP addresses to map (up to 500,000)
Returns: Map report with visualization URL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ips | Yes |
Implementation Reference
- src/mcp_ipinfo/server.py:124-140 (handler)The MCP tool handler for 'map_ips' that joins the IP list into text, calls the IPInfoClient.map_ips method, and returns the map visualization data. Also serves as registration via @mcp.tool() decorator.@mcp.tool() async def map_ips(ips: list[str], ctx: Context[Any, Any, Any]) -> dict[str, Any]: """Create a visual map of IP address locations. Args: ips: List of IP addresses to map (up to 500,000) Returns: Map report with visualization URL. """ client = get_client(ctx) ips_text = "\n".join(ips) try: return await client.map_ips(ips_text) except IPInfoAPIError as e: ctx.error(f"API error: {e.message}") raise
- src/mcp_ipinfo/api_client.py:172-177 (helper)Helper method in IPInfoClient that makes the POST request to IPInfo API /tools/map endpoint to generate IP map visualization.async def map_ips(self, ips: str) -> dict[str, Any]: """Create a map of IP addresses.""" data = await self._request( "POST", "/tools/map", params={"cli": "1"}, data=ips, content_type="text/plain" ) return data