zap.get_alerts_summary
Summarize security alerts by risk level from vulnerability scans to prioritize remediation actions and identify critical threats.
Instructions
Get summary of alerts by risk level
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| baseURL | No | Filter by base URL (optional) |
Implementation Reference
- src/tools/zap.ts:238-260 (registration)Registers the zap.get_alerts_summary MCP tool with input schema (optional baseURL) and a thin handler that retrieves the ZAP client and calls its getAlertsSummary method.server.tool( 'zap.get_alerts_summary', { description: 'Get summary of alerts by risk level', inputSchema: { type: 'object', properties: { baseURL: { type: 'string', description: 'Filter by base URL (optional)', }, }, }, }, async ({ baseURL }: any): Promise<ToolResult> => { const client = getZAPClient(); if (!client) { return formatToolResult(false, null, 'ZAP client not initialized'); } const result = await client.getAlertsSummary(baseURL); return formatToolResult(result.success, result.data, result.error); } );
- src/integrations/zap.ts:260-287 (handler)Implements the core logic for retrieving alerts summary from ZAP by calling the /alert/view/alertCountsByRisk/ API endpoint, parsing counts by risk level (informational, low, medium, high, critical), and returning formatted ZAPScanResult.async getAlertsSummary(baseURL?: string): Promise<ZAPScanResult> { try { const params: any = {}; if (baseURL) params.baseurl = baseURL; const response = await this.client.get('/alert/view/alertCountsByRisk/', { params }); // Parse the response - ZAP returns alertCountsByRisk with risk levels as keys const summaryData = response.data.alertCountsByRisk || response.data; return { success: true, data: { informational: summaryData['0'] || summaryData.Informational || 0, low: summaryData['1'] || summaryData.Low || 0, medium: summaryData['2'] || summaryData.Medium || 0, high: summaryData['3'] || summaryData.High || 0, critical: summaryData['4'] || summaryData.Critical || 0, raw: summaryData, }, }; } catch (error: any) { return { success: false, error: error.message || 'Failed to get alerts summary', }; } }
- src/integrations/zap.ts:3-7 (schema)Type definition for ZAPScanResult, the standardized return type used by getAlertsSummary and other ZAP API methods.export interface ZAPScanResult { success: boolean; data?: any; error?: string; }