Skip to main content
Glama
mohdhaji87

Nmap MCP Server

by mohdhaji87

nmap_script_scan

Execute NSE scripts to detect vulnerabilities, identify services, and analyze network security on specified targets.

Instructions

Run NSE (Nmap Scripting Engine) scripts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetsYes
scriptsNodefault
portsNocommon

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the nmap_script_scan tool. It takes targets, scripts, and ports as input, constructs Nmap arguments for NSE scripts, runs the command via run_nmap_command, and returns the formatted output or error.
    async def nmap_script_scan(
        targets: str,
        scripts: str = "default",
        ports: str = "common"
    ) -> str:
        """Run NSE (Nmap Scripting Engine) scripts."""
        args = [f"--script={scripts}", "-p", ports, targets]
        
        result = run_nmap_command(args)
        
        if result["success"]:
            return f"NSE script scan completed:\n\n{result['stdout']}"
        else:
            return f"NSE script scan failed:\n\n{result['stderr']}"
  • server.py:159-162 (registration)
    The @app.tool decorator that registers the nmap_script_scan function as a tool, providing the name and description. The input schema is inferred from the function's type annotations.
    @app.tool(
        name="nmap_script_scan",
        description="Run NSE (Nmap Scripting Engine) scripts"
    )
  • The function signature defining the input parameters (targets: str, scripts: str='default', ports: str='common') and return type (str), which serves as the tool schema.
    async def nmap_script_scan(
        targets: str,
        scripts: str = "default",
        ports: str = "common"
    ) -> str:
Behavior1/5

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

No annotations are provided, so the description carries full burden but fails to disclose behavioral traits. It doesn't mention if this is a read-only or destructive operation, network impact, permissions needed, rate limits, or output format. The description is minimal and adds no context beyond the basic action.

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 with no wasted words. It's front-loaded and appropriately sized for the tool's complexity, though it could benefit from more detail given the lack of annotations and schema coverage.

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 (3 parameters, 0% schema coverage, no annotations) and the presence of an output schema, the description is incomplete. It doesn't explain parameter meanings, usage context, or behavioral aspects, relying too heavily on the output schema to cover return values without addressing input or operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain what 'targets', 'scripts', or 'ports' mean, their formats (e.g., IP ranges, script names, port lists), or default behaviors. This leaves key semantics undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Run NSE (Nmap Scripting Engine) scripts' clearly states the action (run) and resource (NSE scripts), but it's vague about what this entails compared to siblings like nmap_vulnerability_scan or nmap_service_detection, which might also use scripts. It doesn't specify if this is for targeted script execution versus broader scanning.

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?

No guidance is provided on when to use this tool versus alternatives. With many sibling tools (e.g., nmap_vulnerability_scan, nmap_service_detection), the description lacks context on whether this is for custom scripts, default scripts, or specific use cases, leaving the agent to guess based on the name alone.

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/mohdhaji87/Nmap-MCP-Server'

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