zap.get_spider_status
Check the current status of an active web spider scan to monitor crawling progress and completion for security testing.
Instructions
Get the status of a spider scan
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scanId | Yes | Spider scan ID |
Implementation Reference
- src/tools/zap.ts:100-123 (registration)Registers the 'zap.get_spider_status' MCP tool, including input schema (requires scanId) and handler wrapper that delegates to ZAPClient.getSpiderStatus()server.tool( 'zap.get_spider_status', { description: 'Get the status of a spider scan', inputSchema: { type: 'object', properties: { scanId: { type: 'string', description: 'Spider 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.getSpiderStatus(scanId); return formatToolResult(result.success, result.data, result.error); } );
- src/integrations/zap.ts:124-143 (handler)Core handler implementation in ZAPClient class. Fetches spider scan status from ZAP API endpoint '/spider/view/status/' and formats progress/status.async getSpiderStatus(scanId: string): Promise<ZAPScanResult> { try { const response = await this.client.get('/spider/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 spider status', }; } }
- src/integrations/zap.ts:9-13 (schema)Type definition for the spider status result returned by the handler (scanId, progress, status).export interface ZAPSpiderResult { scanId: string; progress: number; status: string; }
- src/index.ts:49-49 (registration)Top-level call to register all ZAP tools (including zap.get_spider_status) on the MCP server.registerZAPTools(server);
- src/integrations/zap.ts:494-506 (helper)Singleton initialization and getter for ZAPClient instance used by the tool handler.export function initZAP(baseURL?: string, apiKey?: string): ZAPClient { if (!zapClient) { zapClient = new ZAPClient( baseURL || process.env.ZAP_URL || 'http://localhost:8081', apiKey || process.env.ZAP_API_KEY ); } return zapClient; } export function getZAPClient(): ZAPClient | null { return zapClient; }