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();
    }
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. It mentions the free tier query limit but lacks details about rate limiting, authentication requirements, error handling, or what happens when quota is exceeded. Critical behavioral context is missing.

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 extremely concise: one sentence stating the core purpose and one sentence noting the free tier limit. Every word serves a purpose, and the key action is front-loaded. No wasted content.

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?

For a simple tool with one parameter and no output schema, the description covers the purpose and a key constraint (free tier limit). However, it does not describe the return format or any usage nuances. Additional detail on output would improve completeness.

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?

The input schema already provides a description for the 'query' parameter (IP address or ASN). The description repeats this without adding new meaning or usage details. With 100% schema coverage, baseline is 3; no additional parameter semantics are provided.

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. It is not a tautology and provides the resource (ASN info) and method (look up). However, it does not explicitly differentiate from sibling tools like bgp_asn or geoip_lookup, though the name and description together uniquely identify it.

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?

The description does not provide guidance on when to use this tool versus alternatives. It only mentions the free tier limit (50 queries/day) as a constraint, but no proactive usage context or when-not-to-use advice is included.

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

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