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:239-260 (registration)MCP tool registration for 'zap.get_alerts_summary', including input schema, description, and inline handler function that uses ZAPClient to fetch alerts summary.'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/tools/zap.ts:252-259 (handler)Inline handler function for the tool, which initializes ZAP client if needed and calls getAlertsSummary, formatting the result.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/tools/zap.ts:240-251 (schema)Input schema and description for the zap.get_alerts_summary tool.{ description: 'Get summary of alerts by risk level', inputSchema: { type: 'object', properties: { baseURL: { type: 'string', description: 'Filter by base URL (optional)', }, }, }, },
- src/integrations/zap.ts:260-287 (helper)Core implementation of getAlertsSummary in ZAPClient class: Calls ZAP API /alert/view/alertCountsByRisk/, parses response into risk-level counts (informational, low, medium, high, critical).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/index.ts:49-49 (registration)Top-level call to registerZAPTools which includes the zap.get_alerts_summary tool among other ZAP tools.registerZAPTools(server);