Skip to main content
Glama

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
NameRequiredDescriptionDefault
scanIdYesSpider scan ID

Implementation Reference

  • 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);
      }
    );
  • 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',
        };
      }
    }
  • 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);
  • 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;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/telmon95/VulneraMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server