get_ipinfo_api_token
Verify if the IPINFO_API_TOKEN is configured to enable premium IP geolocation features like ASN info, VPN detection, carrier details, and improved accuracy for advanced IP analysis.
Instructions
Check if the IPINFO_API_TOKEN environment variable is configured for enhanced IP lookups.
This tool verifies whether the IPInfo API token is properly configured in the environment. The token enables access to premium features like ASN information, privacy detection, carrier details, and enhanced accuracy for IP geolocation analysis.
Common use cases:
Verify API token configuration before performing advanced IP analysis
Troubleshoot why certain IP lookup features are unavailable
Check system configuration for applications requiring premium IP data
Validate environment setup during deployment or testing
Determine available feature set for IP analysis workflows
Args: ctx: The MCP request context.
Returns: bool: True if IPINFO_API_TOKEN environment variable is set and configured, False if the token is missing or not configured.
Examples: # Check if premium features are available has_token = get_ipinfo_api_token() if has_token: # Safe to use advanced IP analysis features details = get_ip_details("8.8.8.8") # Will include ASN, privacy data else: # Limited to basic IP information only details = get_ip_details("8.8.8.8") # Basic location/ISP only
Note: The IPInfo API provides basic location and ISP information without authentication, but premium features (ASN details, VPN/proxy detection, carrier information, enhanced accuracy) require a valid API token from https://ipinfo.io/.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_server_ipinfo/server.py:176-222 (handler)The handler function for the get_ipinfo_api_token tool. It is registered via the @mcp.tool() decorator and simply returns the value of the IPINFO_API_TOKEN environment variable or None if not set.@mcp.tool() def get_ipinfo_api_token(ctx: Context) -> str | None: """Check if the IPINFO_API_TOKEN environment variable is configured for enhanced IP lookups. This tool verifies whether the IPInfo API token is properly configured in the environment. The token enables access to premium features like ASN information, privacy detection, carrier details, and enhanced accuracy for IP geolocation analysis. Common use cases: - Verify API token configuration before performing advanced IP analysis - Troubleshoot why certain IP lookup features are unavailable - Check system configuration for applications requiring premium IP data - Validate environment setup during deployment or testing - Determine available feature set for IP analysis workflows Args: ctx: The MCP request context. Returns: bool: True if IPINFO_API_TOKEN environment variable is set and configured, False if the token is missing or not configured. Examples: # Check if premium features are available has_token = get_ipinfo_api_token() if has_token: # Safe to use advanced IP analysis features details = get_ip_details("8.8.8.8") # Will include ASN, privacy data else: # Limited to basic IP information only details = get_ip_details("8.8.8.8") # Basic location/ISP only # Use in conditional workflows if get_ipinfo_api_token(): # Perform advanced IP geolocation analysis pass else: # Fall back to basic analysis or prompt for token configuration pass Note: The IPInfo API provides basic location and ISP information without authentication, but premium features (ASN details, VPN/proxy detection, carrier information, enhanced accuracy) require a valid API token from https://ipinfo.io/. """ return os.environ.get("IPINFO_API_TOKEN")
- src/mcp_server_ipinfo/server.py:176-176 (registration)The @mcp.tool() decorator registers the get_ipinfo_api_token function as an MCP tool.@mcp.tool()