Skip to main content
Glama

check_ip_threats

Analyze IP addresses using the URLhaus blacklist to identify potential security threats in real-time network traffic. Enhance threat detection and network diagnostics with actionable insights.

Instructions

Check a given IP address against URLhaus blacklist for IOCs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesIP address to check (e.g., 192.168.1.1)

Implementation Reference

  • The main handler function for the 'check_ip_threats' tool. It takes an IP address, fetches the latest IP blacklist from URLhaus using axios, parses it for IPv4 addresses, checks if the input IP is listed, and returns a text response indicating if it's a threat.
    async (args) => {
      try {
        const { ip } = args;
        console.error(`Checking IP ${ip} against URLhaus blacklist`);
    
        const urlhausUrl = 'https://urlhaus.abuse.ch/downloads/text/';
        console.error(`Fetching URLhaus blacklist from ${urlhausUrl}`);
        let urlhausData;
        let isThreat = false;
        try {
          const response = await axios.get(urlhausUrl);
          console.error(`URLhaus response status: ${response.status}, length: ${response.data.length} chars`);
          console.error(`URLhaus raw data (first 200 chars): ${response.data.slice(0, 200)}`);
          const ipRegex = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;
          urlhausData = [...new Set(response.data.split('\n')
            .map(line => {
              const match = line.match(ipRegex);
              return match ? match[0] : null;
            })
            .filter(ip => ip))];
          console.error(`URLhaus lookup successful: ${urlhausData.length} blacklist IPs fetched`);
          console.error(`Sample URLhaus IPs: ${urlhausData.slice(0, 5).join(', ') || 'None'}`);
          isThreat = urlhausData.includes(ip);
          console.error(`IP ${ip} checked against URLhaus: ${isThreat ? 'Threat found' : 'No threat found'}`);
        } catch (e) {
          console.error(`Failed to fetch URLhaus data: ${e.message}`);
          urlhausData = [];
        }
    
        const outputText = `IP checked: ${ip}\n\n` +
          `Threat check against URLhaus blacklist:\n${
            isThreat ? 'Potential threat detected in URLhaus blacklist.' : 'No threat detected in URLhaus blacklist.'
          }`;
    
        return {
          content: [{ type: 'text', text: outputText }],
        };
      } catch (error) {
        console.error(`Error in check_ip_threats: ${error.message}`);
        return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true };
      }
    }
  • The Zod input schema for the tool, validating a single 'ip' parameter as an IPv4 address.
    {
      ip: z.string().regex(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/).describe('IP address to check (e.g., 192.168.1.1)'),
    },
  • index.js:250-298 (registration)
    Registers the 'check_ip_threats' tool on the MCP server using server.tool(), including name, description, schema, and handler function.
    server.tool(
      'check_ip_threats',
      'Check a given IP address against URLhaus blacklist for IOCs',
      {
        ip: z.string().regex(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/).describe('IP address to check (e.g., 192.168.1.1)'),
      },
      async (args) => {
        try {
          const { ip } = args;
          console.error(`Checking IP ${ip} against URLhaus blacklist`);
    
          const urlhausUrl = 'https://urlhaus.abuse.ch/downloads/text/';
          console.error(`Fetching URLhaus blacklist from ${urlhausUrl}`);
          let urlhausData;
          let isThreat = false;
          try {
            const response = await axios.get(urlhausUrl);
            console.error(`URLhaus response status: ${response.status}, length: ${response.data.length} chars`);
            console.error(`URLhaus raw data (first 200 chars): ${response.data.slice(0, 200)}`);
            const ipRegex = /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/;
            urlhausData = [...new Set(response.data.split('\n')
              .map(line => {
                const match = line.match(ipRegex);
                return match ? match[0] : null;
              })
              .filter(ip => ip))];
            console.error(`URLhaus lookup successful: ${urlhausData.length} blacklist IPs fetched`);
            console.error(`Sample URLhaus IPs: ${urlhausData.slice(0, 5).join(', ') || 'None'}`);
            isThreat = urlhausData.includes(ip);
            console.error(`IP ${ip} checked against URLhaus: ${isThreat ? 'Threat found' : 'No threat found'}`);
          } catch (e) {
            console.error(`Failed to fetch URLhaus data: ${e.message}`);
            urlhausData = [];
          }
    
          const outputText = `IP checked: ${ip}\n\n` +
            `Threat check against URLhaus blacklist:\n${
              isThreat ? 'Potential threat detected in URLhaus blacklist.' : 'No threat detected in URLhaus blacklist.'
            }`;
    
          return {
            content: [{ type: 'text', text: outputText }],
          };
        } catch (error) {
          console.error(`Error in check_ip_threats: ${error.message}`);
          return { content: [{ type: 'text', text: `Error: ${error.message}` }], isError: true };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Check') but doesn't describe what happens during execution (e.g., network call, rate limits, authentication needs, response format, or error handling). This leaves significant gaps for a tool that likely involves external API calls.

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 a single, efficient sentence that directly states the tool's function without unnecessary words. It's appropriately sized and front-loaded with the core action, making it easy to parse quickly.

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 the complexity of threat-checking (likely involving external APIs), no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns (e.g., threat score, details, or just a boolean), error conditions, or operational constraints, leaving critical context missing.

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%, with the parameter 'ip' well-documented in the schema (including pattern validation). The description adds no additional parameter semantics beyond implying it's for threat checking, so it meets the baseline of 3 where the schema does the heavy lifting.

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 verb ('Check') and resource ('IP address') with specific context ('against URLhaus blacklist for IOCs'), making the purpose unambiguous. However, it doesn't explicitly distinguish this tool from sibling 'check_threats', which appears to be a similar threat-checking tool, preventing a perfect score.

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 provides no guidance on when to use this tool versus alternatives like 'check_threats' or other siblings. It mentions the specific blacklist (URLhaus) but doesn't explain why one would choose this over other threat-checking methods or tools, leaving usage context unclear.

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

Related 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/0xKoda/WireMCP'

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