zap.get_active_scan_status
Check the current status of an active vulnerability scan to monitor progress and identify when testing is complete.
Instructions
Get the status of an active scan
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scanId | Yes | Active scan ID |
Implementation Reference
- src/tools/zap.ts:175-198 (registration)Registration of the MCP tool 'zap.get_active_scan_status' including input schema and inline handler function that delegates to ZAPClient.getActiveScanStatus.
server.tool( 'zap.get_active_scan_status', { description: 'Get the status of an active scan', inputSchema: { type: 'object', properties: { scanId: { type: 'string', description: 'Active scan ID', }, }, required: ['scanId'], }, }, async ({ scanId }: any): Promise<ToolResult> => { const client = getZAPClient(); if (!client) { return formatToolResult(false, null, 'ZAP client not initialized'); } const result = await client.getActiveScanStatus(scanId); return formatToolResult(result.success, result.data, result.error); } ); - src/integrations/zap.ts:182-201 (handler)Core handler implementation in ZAPClient class: queries ZAP REST API endpoint /ascan/view/status/ to retrieve the scan ID, progress percentage, and status (running/completed).
async getActiveScanStatus(scanId: string): Promise<ZAPScanResult> { try { const response = await this.client.get('/ascan/view/status/', { params: { scanId: scanId.toString() }, }); return { success: true, data: { scanId, progress: parseInt(response.data.status || '0') || 0, status: response.data.status === '100' ? 'completed' : 'running', }, }; } catch (error: any) { return { success: false, error: error.message || 'Failed to get active scan status', }; } } - src/integrations/zap.ts:15-19 (schema)TypeScript interface defining the structure of the active scan status result returned by the handler.
export interface ZAPActiveScanResult { scanId: string; progress: number; status: string; } - src/integrations/zap.ts:504-506 (helper)Singleton accessor function for the ZAPClient instance, used by the MCP tool handler.
export function getZAPClient(): ZAPClient | null { return zapClient; }