Skip to main content
Glama
briandconnelly

IP Geolocation MCP Server

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

# 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/.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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")
  • The @mcp.tool() decorator registers the get_ipinfo_api_token function as an MCP tool.
    @mcp.tool()
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well. It explains what the tool checks (environment variable configuration), what it returns (boolean), and the implications for feature availability. It also mentions the authentication requirements for premium features and provides the source URL. However, it doesn't specify error handling or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections, but it's quite lengthy for a simple 0-parameter tool. The 'Common use cases' section has 5 bullet points where 2-3 would suffice, and the examples section includes two full code examples that are somewhat redundant. The information is valuable but could be more efficiently presented.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 0-parameter tool with no output schema, the description provides comprehensive context about what the tool does, when to use it, and the implications of its boolean return value. It explains the difference between basic and premium IPInfo features and provides practical examples. The main gap is the lack of error handling information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description appropriately doesn't waste space discussing non-existent parameters, though it does mention 'ctx: The MCP request context' in the Args section which is technically unnecessary but not harmful.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Check if the IPINFO_API_TOKEN environment variable is configured for enhanced IP lookups.' It uses specific verbs ('check', 'verify') and distinguishes from its sibling tool get_ip_details by focusing on token verification rather than IP analysis itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool versus alternatives through the 'Common use cases' section and examples. It clearly indicates this tool should be used before performing advanced IP analysis with get_ip_details, and distinguishes between premium vs basic feature availability.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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

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