Skip to main content
Glama
imjdl

Nmap MCP Server

get-scan-details

Retrieve detailed results from a specific Nmap network scan to analyze findings and assess security posture.

Instructions

Get detailed information about a specific scan

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scan_idYesID of the scan to retrieve

Implementation Reference

  • Handler for the 'get-scan-details' tool. Retrieves the scan data by ID, computes summary stats like hosts up and total ports, and returns a formatted text summary pointing to the full resource.
    elif name == "get-scan-details":
        scan_id = arguments.get("scan_id")
        
        if not scan_id:
            raise ValueError("Missing scan_id")
            
        if scan_id not in scan_results:
            return [
                types.TextContent(
                    type="text",
                    text=f"Scan with ID {scan_id} not found",
                )
            ]
            
        scan_data = scan_results[scan_id]
        
        # Extract summary information
        hosts_up = sum(1 for host in scan_data.get("hosts", []) if host.get("status") == "up")
        total_ports = sum(len(host.get("services", [])) for host in scan_data.get("hosts", []))
        
        return [
            types.TextContent(
                type="text",
                text=f"Scan of {scan_data.get('target')} (ID: {scan_id}):\n"
                     f"- Options: {scan_data.get('options')}\n"
                     f"- Timestamp: {scan_data.get('timestamp')}\n"
                     f"- Hosts: {len(scan_data.get('hosts', []))} ({hosts_up} up)\n"
                     f"- Total ports/services: {total_ports}\n\n"
                     f"Use the nmap://scan/{scan_id} resource to access full results",
            )
        ]
  • Input schema for the 'get-scan-details' tool, defining the required 'scan_id' string parameter.
    inputSchema={
        "type": "object",
        "properties": {
            "scan_id": {"type": "string", "description": "ID of the scan to retrieve"},
        },
        "required": ["scan_id"],
    },
  • Tool registration in the list_tools() response, defining name, description, and input schema for 'get-scan-details'.
    types.Tool(
        name="get-scan-details",
        description="Get detailed information about a specific scan",
        inputSchema={
            "type": "object",
            "properties": {
                "scan_id": {"type": "string", "description": "ID of the scan to retrieve"},
            },
            "required": ["scan_id"],
        },
    ),
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/imjdl/nmap-mcpserver'

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