Skip to main content
Glama

Run Masscan

run_masscan

Scan TCP ports across IP ranges and CIDRs asynchronously, adjust packet rate, grab banners, and exclude sensitive hosts during penetration testing reconnaissance.

Instructions

Masscan is an extremely fast asynchronous TCP port scanner. Tags: network, scanner, security, pentest, enumeration, port-scanner, reconnaissance

Usage Guide:

  • Basic Scanning: Provide a target_range (IP or CIDR) and ports (comma-separated or range).

  • Internet Scale: To scan the entire IPv4 space, set target_range to "0.0.0.0/0".

  • Performance: Use rate to adjust packets-per-second (pps). Default is 1000; use 100000+ for high-speed lines.

  • Fingerprinting: Set banners to True to perform banner grabbing (requires full TCP handshake).

  • Safety: Use exclude_range to prevent scanning sensitive production or medical equipment.

  • Networking: Use source_ip, source_mac, and gateway_mac if masscan cannot auto-detect your interface.

  • Configuration: Use config_file to load scan parameters from a saved .conf file.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "run_masscan"
  }
}

Input Schema

NameRequiredDescriptionDefault
rateNo
portsNo
bannersNo
source_ipNo
source_macNo
config_fileNo
gateway_macNo
output_fileNo
target_rangeNoTarget IP address or range (e.g., 192.168.1.0/24 or 0.0.0.0/0).
exclude_rangeNoIP range to exclude from the scan.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does add real behavior: banners require a full TCP handshake, rate is in packets-per-second with a 1000 default, and source_ip/source_mac/gateway_mac exist as fallbacks when interface auto-detection fails. It omits operational traits that matter for a raw-socket scanner, such as elevated-privilege requirements and expected runtime/noisy-network side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The definition is front-loaded with a one-line statement of what the tool is, then structured bullets keyed by concern, which is easy to scan. The tags line is low-value filler for an agent, and a couple of bullets restate parameter names without adding much.

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?

For a 10-parameter tool with no annotations, the description covers nearly every parameter and the main operational caveats, and an output schema exists so return values need not be explained. The remaining gap is output_file and any note on privileges or authorization for internet-scale scanning.

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 coverage is only 20%, so the description must compensate, and it largely does: rate units and scaling advice, ports format, banners trade-off, exclude_range purpose, the three network-interface overrides, and config_file semantics. Only output_file is left unexplained in both schema and description.

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 opens with a specific verb+resource statement ('Masscan is an extremely fast asynchronous TCP port scanner') and adds discovery tags. It implies speed-based differentiation from a general-purpose scanner, but never names a sibling such as run_nmap to make the distinction explicit.

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

Usage Guidelines4/5

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

It gives concrete invocation scenarios: basic target_range+ports scanning, internet-scale via 0.0.0.0/0, rate tuning, banner grabbing, exclusion for safety, interface fallbacks, and config-file reuse. The guidance is about how to configure a scan rather than when to pick this tool over alternative scanners, and there are no explicit exclusions.

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