get_scan_status
Track and monitor the progress of active scans by retrieving their real-time status using the scan ID, ensuring efficient management of vulnerability assessments.
Instructions
Check the status of a running scan
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scan_id | Yes | ID of the scan to check |
Implementation Reference
- src/tools/scans.ts:131-159 (handler)The handler function for the 'get_scan_status' tool. It validates the scan_id argument, calls the getScanStatus helper, formats the response as JSON, and handles errors.export const getScanStatusToolHandler = async (args: Record<string, unknown>) => { try { // Validate arguments const scanId = validateScanId(args.scan_id); // Get scan status const status = await getScanStatus(scanId); return { content: [ { type: 'text', text: JSON.stringify(status, null, 2) } ] }; } catch (error) { const mcpError = handleNessusApiError(error); return { content: [ { type: 'text', text: `Error: ${mcpError.message}` } ], isError: true }; } };
- src/tools/scans.ts:116-129 (schema)The schema definition for the 'get_scan_status' tool, specifying the input requirements including the required 'scan_id' parameter.export const getScanStatusToolSchema = { name: 'get_scan_status', description: 'Check the status of a running scan', inputSchema: { type: 'object', properties: { scan_id: { type: 'string', description: 'ID of the scan to check' } }, required: ['scan_id'] } };
- src/index.ts:101-102 (registration)The tool is registered in the main CallToolRequestHandler switch statement, dispatching calls to the getScanStatusToolHandler.case 'get_scan_status': return await getScanStatusToolHandler(args);
- src/nessus-api.ts:85-92 (helper)The core helper function getScanStatus that fetches the scan status, using mock data or throwing for real API (not implemented). Called by the tool handler.export const getScanStatus = async (scanId: string) => { if (config.useMock) { return getMockScanStatus(scanId); } // Real API implementation would go here throw new Error("Real API not implemented"); };