Skip to main content
Glama
badchars

osint-mcp-server

by badchars

hackertarget_aslookup

Look up ASN information for a given IP address or ASN using HackerTarget's API. Free tier allows 50 queries per day.

Instructions

Look up ASN information for an IP or ASN via HackerTarget. Free tier: 50 queries/day.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesIP address or ASN to look up

Implementation Reference

  • The main handler function for the hackertarget_aslookup tool. Calls the HackerTarget 'aslookup' API endpoint, parses CSV lines into ASN/IP/owner entries, and returns the result.
    export async function hackertargetAslookup(query: string): Promise<AslookupResult> {
      const text = await htFetch("aslookup", query);
      const lines = text.split("\n").filter(Boolean);
      const entries: AslookupResult["entries"] = [];
    
      for (const line of lines) {
        const parts = line.split(",").map((p) => p.trim().replace(/^"|"$/g, ""));
        if (parts.length >= 3) {
          entries.push({ asn: parts[0], ip: parts[1], owner: parts[2] });
        }
      }
    
      return { query, raw: text, entries };
    }
  • TypeScript interface AslookupResult defining the return type: query string, raw text, and parsed entries array (asn, ip, owner).
    interface AslookupResult {
      query: string;
      raw: string;
      entries: { asn: string; ip: string; owner: string }[];
    }
  • ToolDef registration for hackertarget_aslookup. Defines name, description, Zod schema (query string), and execute handler that calls hackertargetAslookup.
    const hackertargetAslookupTool: ToolDef = {
      name: "hackertarget_aslookup",
      description: "Look up ASN information for an IP or ASN via HackerTarget. Free tier: 50 queries/day.",
      schema: {
        query: z.string().describe("IP address or ASN to look up"),
      },
      execute: async (args) => json(await hackertargetAslookup(args.query as string)),
    };
  • Tool included in the allTools array export alongside other HackerTarget tools.
    hackertargetAslookupTool,
  • Helper function htFetch that performs the actual HTTP request to api.hackertarget.com with rate limiting, error handling, and daily-limit detection.
    async function htFetch(endpoint: string, query: string): Promise<string> {
      await limiter.acquire();
      const res = await fetch(`https://api.hackertarget.com/${endpoint}/?q=${encodeURIComponent(query)}`);
      if (!res.ok) throw new Error(`HackerTarget returned ${res.status}`);
      const text = await res.text();
      if (text.startsWith("error")) throw new Error(`HackerTarget: ${text}`);
      if (text.includes("API count exceeded")) throw new Error("HackerTarget daily API limit exceeded (50/day free tier)");
      return text.trim();
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations provided, so description carries full burden. It mentions the external service and rate limit but fails to disclose other behavioral traits such as error handling, response format, or whether it is a read-only operation.

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?

Two efficient sentences with zero wasted words. Essential information is front-loaded and every part earns its place.

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

Completeness2/5

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

Given no output schema and presence of similar sibling tools (e.g., bgp_asn), the description lacks sufficient context about return values, error conditions, or when to prefer this over alternatives.

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 baseline is 3. The description adds no extra meaning beyond 'IP address or ASN'—the free tier note is about usage limits, not parameter semantics.

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

Purpose4/5

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

The description clearly states the tool looks up ASN information for an IP or ASN via HackerTarget, with a specific verb and resource. It distinguishes from siblings by naming the service and mentioning the free tier limit.

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

Usage Guidelines2/5

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

No explicit guidance on when to use this tool vs alternatives like bgp_asn or hackertarget_hostsearch. The rate limit hint is implicit usage constraint but lacks conditional context.

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