Skip to main content
Glama
badchars

osint-mcp-server

by badchars

vt_ip

Analyze an IP address with VirusTotal to retrieve reputation, detection statistics, country, ASN, and network information. Requires a VirusTotal API key.

Instructions

VirusTotal IP analysis: reputation, detection stats, country, ASN, network. Requires VT_API_KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesIP address to analyze

Implementation Reference

  • The vtIp function is the core handler for the vt_ip tool. It calls the VirusTotal /ip_addresses/{ip} API endpoint, caches results with a 10-minute TTL, and returns IP reputation, analysis stats, country, ASN, AS owner, and network info.
    export async function vtIp(ip: string, apiKey: string): Promise<VtIpResult> {
      const cacheKey = `vt:ip:${ip}`;
      const cached = cache.get(cacheKey);
      if (cached) return cached;
    
      const data = await vtFetch(`/ip_addresses/${encodeURIComponent(ip)}`, apiKey);
      if (!data) throw new Error(`IP ${ip} not found on VirusTotal`);
    
      const attrs = data.data?.attributes ?? {};
      const result: VtIpResult = {
        ip,
        reputation: attrs.reputation ?? 0,
        analysisStats: attrs.last_analysis_stats ?? { malicious: 0, suspicious: 0, undetected: 0, harmless: 0 },
        country: attrs.country,
        asn: attrs.asn,
        asOwner: attrs.as_owner,
        network: attrs.network,
      };
    
      cache.set(cacheKey, result);
      return result;
    }
  • VtIpResult interface defines the output schema for vt_ip: ip, reputation, analysisStats (malicious/suspicious/undetected/harmless counts), country, asn, asOwner, and network.
    interface VtIpResult {
      ip: string;
      reputation: number;
      analysisStats: VtAnalysisStats;
      country?: string;
      asn?: number;
      asOwner?: string;
      network?: string;
    }
  • Registration of the vt_ip tool as a ToolDef: name 'vt_ip', description, Zod schema (ip: string), and execute handler that extracts API key from config and calls the vtIp function.
    const vtIpTool: ToolDef = {
      name: "vt_ip",
      description: "VirusTotal IP analysis: reputation, detection stats, country, ASN, network. Requires VT_API_KEY.",
      schema: {
        ip: z.string().describe("IP address to analyze"),
      },
      execute: async (args, ctx) => {
        const key = requireApiKey(ctx.config.vtApiKey, "VirusTotal", "VT_API_KEY");
        return json(await vtIp(args.ip as string, key));
      },
    };
  • Generic vtFetch helper used by vtIp — rate-limited fetch to the VirusTotal v3 API with JSON parsing and 404 handling.
    async function vtFetch(path: string, apiKey: string): Promise<any> {
      await limiter.acquire();
      const res = await fetch(`${VT_BASE}${path}`, {
        headers: { "x-apikey": apiKey },
      });
      if (res.status === 404) return null;
      if (!res.ok) throw new Error(`VirusTotal API error: ${res.status} ${res.statusText}`);
      return res.json();
    }
  • src/index.ts:37-37 (registration)
    Tool listing registration: 'vt_ip' is listed under the VirusTotal provider group, requiring VT_API_KEY environment variable.
    { label: "VirusTotal", env: "VT_API_KEY", tools: ["vt_domain", "vt_ip", "vt_subdomains", "vt_url"] },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4/5.0
Behavior3/5

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

Discloses API key requirement and lists returned data types. No annotations provided, so description carries full burden. Lacks mention of potential rate limits, data freshness, or any side effects beyond 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?

Description is a single clear sentence with no wasted words. Front-loads the tool's output and ends with a necessary prerequisite. Perfectly concise for the information conveyed.

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 simple schema (1 param, no output schema), description adequately explains what the tool returns. Could mention input format constraints (e.g., IPv4/IPv6), but overall complete for a straightforward IP analysis tool.

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?

Schema description coverage is 100%, so baseline is 3. Description adds value by specifying the analysis includes reputation, detection stats, country, ASN, and network, going beyond the schema's 'IP address to analyze'.

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?

Description clearly states the tool analyzes an IP address, listing specific data types (reputation, detection stats, country, ASN, network). Distinguishes from siblings like vt_domain and vt_url by focusing on IP.

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?

Mentions requirement for VT_API_KEY, which is a key usage condition. However, it does not provide guidance on when to use this tool versus other IP-analysis tools (e.g., geoip_lookup, shodan_host) or when not to use it.

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