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
| Name | Required | Description | Default |
|---|---|---|---|
| scan_id | Yes | ID of the scan to retrieve |
Implementation Reference
- src/nmap_mcp/server.py:350-380 (handler)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", ) ]
- src/nmap_mcp/server.py:163-169 (schema)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"], },
- src/nmap_mcp/server.py:160-170 (registration)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"], }, ),