Skip to main content
Glama
iplocate

IPLocate

Official
by iplocate

Look up IP Address Privacy & Security

lookup_ip_address_privacy

Check if an IP address uses VPNs, proxies, or anonymizing services; detect hosting providers; and identify abuse blocklist status for security and privacy analysis.

Instructions

Check whether an IP address is detected as a VPN, proxy, other anonymizing service; is on an abuse blocklist; or is a hosting provider. Can look up any IPv4 or IPv6 address, or your own IP if no address is provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipNoIPv4 or IPv6 address to look up. If not provided, returns information about the caller's IP address.

Implementation Reference

  • The main handler function for the 'lookup_ip_address_privacy' tool. Validates the input IP address, fetches geolocation and privacy data from the IPLocate API, extracts the privacy and hosting fields, and returns the result as formatted JSON or an error response.
    async ({ ip }) => {
      if (ip && !isValidIP(ip)) {
        return {
          content: [{
            type: "text",
            text: `Error: "${ip}" is not a valid IPv4 or IPv6 address.`
          }],
          isError: true
        };
      }
    
      try {
        const data = await fetchIPData(ip);
        const privacyData = {
          ip: data.ip,
          privacy: data.privacy,
          hosting: data.hosting
        };
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify(privacyData, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `Error: ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    }
  • src/index.ts:193-235 (registration)
    Registers the 'lookup_ip_address_privacy' tool with the MCP server, including its name, title, description, input schema reference, and inline handler function.
    server.registerTool(
      "lookup_ip_address_privacy",
      {
        title: "Look up IP Address Privacy & Security",
        description: "Check whether an IP address is detected as a VPN, proxy, other anonymizing service; is on an abuse blocklist; or is a hosting provider. Can look up any IPv4 or IPv6 address, or your own IP if no address is provided.",
        inputSchema: IPAddressSchema
      },
      async ({ ip }) => {
        if (ip && !isValidIP(ip)) {
          return {
            content: [{
              type: "text",
              text: `Error: "${ip}" is not a valid IPv4 or IPv6 address.`
            }],
            isError: true
          };
        }
    
        try {
          const data = await fetchIPData(ip);
          const privacyData = {
            ip: data.ip,
            privacy: data.privacy,
            hosting: data.hosting
          };
    
          return {
            content: [{
              type: "text",
              text: JSON.stringify(privacyData, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error: ${error instanceof Error ? error.message : String(error)}`
            }],
            isError: true
          };
        }
      }
    );
  • Shared Zod input schema used by the lookup_ip_address_privacy tool (and other IP tools) defining an optional 'ip' parameter.
    const IPAddressSchema = {
      ip: z.string().optional().describe("IPv4 or IPv6 address to look up. If not provided, returns information about the caller's IP address.")
    };
  • TypeScript interface defining the structure of the IPLocate API response, including 'privacy' and 'hosting' fields used by the tool handler.
    export interface IPLocateResponse {
      ip: string;
      country?: string | null;
      country_code?: string | null;
      is_eu?: boolean;
      city?: string | null;
      continent?: string | null;
      latitude?: number | null;
      longitude?: number | null;
      time_zone?: string | null;
      postal_code?: string | null;
      subdivision?: string | null;
      currency_code?: string | null;
      calling_code?: string | null;
      network?: string | null;
      asn?: ASNInfo | null;
      privacy?: PrivacyInfo;
      company?: CompanyInfo | null;
      hosting?: HostingInfo | null;
      abuse?: AbuseInfo | null;
    }
  • Core helper function that performs the HTTP request to the IPLocate API to retrieve IP data, used by all IP lookup tools including lookup_ip_address_privacy.
    async function fetchIPData(ip?: string): Promise<IPLocateResponse> {
      const baseUrl = "https://iplocate.io/api/lookup";
      const apiKey = process.env.IPLOCATE_API_KEY;
    
      let url = ip ? `${baseUrl}/${ip}` : `${baseUrl}/`;
    
      // Add API key if available
      if (apiKey) {
        url += `?apikey=${apiKey}`;
      }
    
      try {
        const response = await fetch(url, {
          headers: {
            'User-Agent': `mcp-server-iplocate/${VERSION}`
          }
        });
    
        if (!response.ok) {
          const errorText = await response.text();
          let errorMessage = `API request failed with status ${response.status}`;
    
          try {
            const errorJson = JSON.parse(errorText);
            if (errorJson.error) {
              errorMessage = errorJson.error;
            }
          } catch {
            // If not JSON, use the raw text
            if (errorText) {
              errorMessage = errorText;
            }
          }
    
          throw new Error(errorMessage);
        }
    
        const data = await response.json() as IPLocateResponse;
        return data;
      } catch (error) {
        if (error instanceof Error) {
          throw error;
        }
        throw new Error(`Failed to fetch IP data: ${String(error)}`);
      }
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly describes what the tool checks for (VPN/proxy detection, abuse blocklist status, hosting provider identification) and the fallback behavior when no IP is provided. However, it doesn't mention rate limits, authentication requirements, data sources, accuracy limitations, or what format the results will be in.

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

Conciseness5/5

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

The description is perfectly concise with two well-structured sentences. The first sentence clearly states the tool's purpose and capabilities, while the second sentence explains parameter behavior. Every word earns its place with no redundancy or unnecessary information.

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

Completeness3/5

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

Given the tool's moderate complexity (privacy/security checking with fallback behavior) and the absence of both annotations and output schema, the description provides adequate but incomplete context. It explains what the tool checks for and parameter behavior, but doesn't describe the format or structure of results, which is a significant gap since there's no output schema to compensate.

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 schema description coverage is 100%, so the parameter is well-documented in the schema. The description adds value by explaining the semantic meaning of the parameter ('IPv4 or IPv6 address to look up') and clarifying the special case behavior ('If not provided, returns information about the caller's IP address'), which goes beyond the schema's technical specification.

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 with specific verbs ('Check whether an IP address is detected as...') and resources ('VPN, proxy, other anonymizing service; abuse blocklist; hosting provider'). It distinguishes itself from siblings by focusing on privacy/security detection rather than contacts, company, details, location, or network information.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('Check whether an IP address is detected as...') and includes a specific usage scenario ('or your own IP if no address is provided'). However, it doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools for different types of IP lookups.

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

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

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