Skip to main content
Glama

ip_lookup

Retrieve comprehensive IP address information including geolocation, open ports, running services, SSL certificates, hostnames, and cloud provider details. Returns service banners and HTTP server data when available.

Instructions

Retrieve comprehensive information about an IP address, including geolocation, open ports, running services, SSL certificates, hostnames, and cloud provider details if available. Returns service banners and HTTP server information when present.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesThe IP address to query.

Implementation Reference

  • Handler for the ip_lookup tool: validates input using IpLookupArgsSchema, queries the Shodan host API for the given IP, formats the response including IP details, geolocation, open ports/services, cloud info, hostnames, and returns it as formatted JSON text content.
    case "ip_lookup": {
      const parsedIpArgs = IpLookupArgsSchema.safeParse(args);
      if (!parsedIpArgs.success) {
        throw new Error("Invalid ip_lookup arguments");
      }
      const result = await queryShodan(`/shodan/host/${parsedIpArgs.data.ip}`, {});
      
      // Format the response in a user-friendly way
      const formattedResult = {
        "IP Information": {
          "IP Address": result.ip_str,
          "Organization": result.org,
          "ISP": result.isp,
          "ASN": result.asn,
          "Last Update": result.last_update
        },
        "Location": {
          "Country": result.country_name,
          "City": result.city,
          "Coordinates": `${result.latitude}, ${result.longitude}`,
          "Region": result.region_code
        },
        "Services": result.ports.map((port: number) => {
          const service = result.data.find((d: ShodanService) => d.port === port);
          return {
            "Port": port,
            "Protocol": service?.transport || "unknown",
            "Service": service?.data?.trim() || "No banner",
            ...(service?.http ? {
              "HTTP": {
                "Server": service.http.server,
                "Title": service.http.title,
              }
            } : {})
          };
        }),
        "Cloud Provider": result.data[0]?.cloud ? {
          "Provider": result.data[0].cloud.provider,
          "Service": result.data[0].cloud.service,
          "Region": result.data[0].cloud.region
        } : "Not detected",
        "Hostnames": result.hostnames || [],
        "Domains": result.domains || [],
        "Tags": result.tags || []
      };
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(formattedResult, null, 2),
          },
        ],
      };
    }
  • Zod schema defining the input for ip_lookup tool: requires an 'ip' string parameter.
    const IpLookupArgsSchema = z.object({
      ip: z.string().describe("The IP address to query."),
    });
  • src/index.ts:316-320 (registration)
    Registers the ip_lookup tool in the tools list returned by ListToolsRequestSchema handler, including name, description, and input schema converted to JSON schema.
    {
      name: "ip_lookup",
      description: "Retrieve comprehensive information about an IP address, including geolocation, open ports, running services, SSL certificates, hostnames, and cloud provider details if available. Returns service banners and HTTP server information when present.",
      inputSchema: zodToJsonSchema(IpLookupArgsSchema),
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing behavioral traits: it specifies what information is returned (geolocation, open ports, services, SSL certificates, etc.), mentions conditional returns ('when present'), and indicates cloud provider detection. However, it doesn't cover rate limits, authentication needs, or error conditions.

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 front-loaded with the core purpose and efficiently lists return details in a single, well-structured sentence. Every phrase adds value without redundancy.

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?

Given no annotations and no output schema, the description provides good context about return types and conditions. It could be more complete by mentioning response format or error handling, but it adequately covers the tool's scope for a lookup operation.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents the single 'ip' parameter. The description doesn't add parameter-specific details beyond implying the IP address is used for comprehensive lookup, maintaining the baseline score of 3.

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 specific action ('Retrieve comprehensive information') and resource ('about an IP address'), distinguishing it from sibling tools like dns_lookup or reverse_dns_lookup by focusing on IP-specific intelligence rather than DNS resolution.

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

Usage Guidelines3/5

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

The description implies usage context by listing the types of information returned (geolocation, services, etc.), but doesn't explicitly state when to use this tool versus alternatives like shodan_search or when not to use it (e.g., for domain-based queries).

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/BurtTheCoder/mcp-shodan'

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