get-scan-details
Retrieve comprehensive details about a specific scan using the scan ID to analyze network security and results through the Nmap MCP Server.
Instructions
Get detailed information about a specific scan
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scan_id | Yes | ID of the scan to retrieve |
Input Schema (JSON Schema)
{
"properties": {
"scan_id": {
"description": "ID of the scan to retrieve",
"type": "string"
}
},
"required": [
"scan_id"
],
"type": "object"
}
Implementation Reference
- src/nmap_mcp/server.py:350-380 (handler)The handler logic for the 'get-scan-details' tool within the handle_call_tool function. It validates the scan_id, retrieves the scan data from the global scan_results dictionary, computes summary statistics (number of hosts up and total ports/services), and returns a formatted text content with the details.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:160-170 (registration)Registration of the 'get-scan-details' tool in the handle_list_tools function, defining the tool name, description, and input schema requiring a 'scan_id' string.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"], }, ),
- src/nmap_mcp/server.py:163-169 (schema)Input schema for the 'get-scan-details' tool, specifying an object with a required 'scan_id' property of type string.inputSchema={ "type": "object", "properties": { "scan_id": {"type": "string", "description": "ID of the scan to retrieve"}, }, "required": ["scan_id"], },