Skip to main content
Glama

scan-ports

Scan a target host or network to identify open ports, their states, and running services, supporting security assessments and vulnerability identification.

Instructions

Scan ports on a target host or network.

Performs a port scan using nmap with the specified parameters. Validates all inputs to prevent command injection.

IMPORTANT: Only scan targets you are authorized to scan.

Returns: ScanResult with discovered hosts, ports, and their states.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portsNoPort specification. Examples: "22", "1-1024", "22,80,443", "T:22,80,U:53" for protocol-specific. If omitted, scans nmap default ports.
targetYesTarget to scan: IP address (192.168.1.1), hostname (example.com), or CIDR notation (192.168.1.0/24). Max /24 network size.
timingNoTiming template: "paranoid", "sneaky", "polite", "normal", "aggressive", "insane". Default: "normal".normal
timeoutNoMaximum scan duration in seconds. Default: 600.
scan_typeNoScan type: "connect" (TCP connect, no root needed), "syn" (SYN stealth, needs root), "udp" (UDP, needs root), "fin", "xmas", "null", "ack". Default: "connect".connect
service_detectionNoEnable service/version detection (-sV). Slower but identifies running software.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostsNoResults per host
commandYesThe nmap command that was executed (sanitized)
warningsNoScan warnings
raw_outputNoRaw nmap output text
scan_statsNoScan statistics
Behavior4/5

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

With no annotations provided, the description must disclose behavioral traits. It does include the security warning 'Only scan targets you are authorized to scan' and mentions input validation to prevent command injection. However, it does not disclose potential side effects like network load or root privileges for certain scan types, which are left to the parameter descriptions.

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 three short paragraphs: purpose, validation and authorization note, and return value. It is front-loaded with the primary purpose and contains no redundant sentences, making it concise and well-structured.

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?

The description covers the core operation and return value but is sparse on contextual guidance such as when to use different scan types or how results map to the output schema. However, the schema provides rich parameter details and the output schema is available, so the description is adequate for the tool's complexity.

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 has 100% description coverage across all six parameters, so the description does not need to add parameter details. The main description mentions scanning with specified parameters but adds no additional information about parameter formats or defaults, meeting the baseline without extra value.

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?

The description clearly states 'Scan ports on a target host or network' and 'Performs a port scan using nmap with the specified parameters.' This identifies the specific action and resource, distinguishing it from sibling tools like discover-hosts or detect-services.

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?

The description does not explicitly state when to use this tool versus alternatives like quick-scan or detect-services. It includes an authorization warning but lacks usage conditions or exclusions, making the usage context implied rather than explicit.

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/vorotaai/nmap-mcp'

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