Skip to main content
Glama

zap.start_active_scan

Initiate an active vulnerability scan on a target URL to identify security weaknesses using automated testing techniques.

Instructions

Start an active vulnerability scan on a target URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesTarget URL to scan
recurseNoWhether to recurse into subdirectories (optional)
inScopeOnlyNoOnly scan URLs in scope (optional)
scanPolicyNameNoScan policy name to use (optional)
methodNoHTTP method (optional)
postDataNoPOST data (optional)

Implementation Reference

  • Full registration of the MCP tool 'zap.start_active_scan', defining its input schema, description, and handler function that delegates to ZAPClient.startActiveScan after client check and saves results.
    server.tool(
      'zap.start_active_scan',
      {
        description: 'Start an active vulnerability scan on a target URL',
        inputSchema: {
          type: 'object',
          properties: {
            url: {
              type: 'string',
              description: 'Target URL to scan',
            },
            recurse: {
              type: 'boolean',
              description: 'Whether to recurse into subdirectories (optional)',
            },
            inScopeOnly: {
              type: 'boolean',
              description: 'Only scan URLs in scope (optional)',
            },
            scanPolicyName: {
              type: 'string',
              description: 'Scan policy name to use (optional)',
            },
            method: {
              type: 'string',
              description: 'HTTP method (optional)',
            },
            postData: {
              type: 'string',
              description: 'POST data (optional)',
            },
          },
          required: ['url'],
        },
      },
      async ({ url, recurse, inScopeOnly, scanPolicyName, method, postData }: any): Promise<ToolResult> => {
        const client = getZAPClient();
        if (!client) {
          return formatToolResult(false, null, 'ZAP client not initialized');
        }
        const result = await client.startActiveScan(url, recurse, inScopeOnly, scanPolicyName, method, postData);
        if (result.success) {
          await safeSaveTestResult(url, 'zap_active_scan', true, result.data);
        }
        return formatToolResult(result.success, result.data, result.error);
      }
    );
  • Core handler in ZAPClient class that performs the actual active scan by calling ZAP REST API endpoint /ascan/action/scan/ with parameters and returns scan ID or error.
    async startActiveScan(url: string, recurse?: boolean, inScopeOnly?: boolean, scanPolicyName?: string, method?: string, postData?: string): Promise<ZAPScanResult> {
      try {
        const params: any = { url };
        if (recurse !== undefined) params.recurse = recurse;
        if (inScopeOnly !== undefined) params.inScopeOnly = inScopeOnly;
        if (scanPolicyName) params.scanPolicyName = scanPolicyName;
        if (method) params.method = method;
        if (postData) params.postData = postData;
    
        const response = await this.client.get('/ascan/action/scan/', { params });
        
        // Handle different response formats
        const scanId = response.data.scan || response.data.scanId || response.data;
        if (!scanId && scanId !== 0) {
          throw new Error('No scan ID returned from ZAP');
        }
        
        return {
          success: true,
          data: {
            scanId: scanId.toString(),
          },
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message || 'Failed to start active scan',
        };
      }
    }
  • Helper function used by the tool handler to safely persist scan results to database without crashing on failure.
    async function safeSaveTestResult(
      target: string,
      testType: string,
      success: boolean,
      resultData?: any,
      errorMessage?: string,
      score?: number,
      payload?: string,
      responseData?: string
    ) {
      try {
        await saveTestResult(target, testType, success, resultData, errorMessage, score, payload, responseData);
      } catch (error: any) {
        console.error(`[ZAP] Failed to save test result (${testType}):`, error?.message || error);
      }
    }
  • Input schema definition for the zap.start_active_scan tool, specifying parameters like url (required), recurse, inScopeOnly, etc.
    {
      description: 'Start an active vulnerability scan on a target URL',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'Target URL to scan',
          },
          recurse: {
            type: 'boolean',
            description: 'Whether to recurse into subdirectories (optional)',
          },
          inScopeOnly: {
            type: 'boolean',
            description: 'Only scan URLs in scope (optional)',
          },
          scanPolicyName: {
            type: 'string',
            description: 'Scan policy name to use (optional)',
          },
          method: {
            type: 'string',
            description: 'HTTP method (optional)',
          },
          postData: {
            type: 'string',
            description: 'POST data (optional)',
          },
        },
        required: ['url'],
      },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Start an active vulnerability scan' implies a potentially resource-intensive, intrusive operation, it doesn't specify important behavioral traits like whether this requires authentication, what permissions are needed, whether it's destructive to the target, typical runtime, rate limits, or what happens after initiation. The description is too minimal for a tool that performs active security scanning.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently communicates the core purpose. There's no wasted language or unnecessary elaboration. It's appropriately sized for what it communicates, though what it communicates is limited in scope.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that initiates active vulnerability scanning with 6 parameters and no output schema, the description is insufficient. It doesn't explain what the tool returns, what happens after scanning starts, how to monitor progress (though 'zap.get_active_scan_status' exists as a sibling), or important behavioral considerations. With no annotations and no output schema, the description should provide more context about this significant operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the input schema. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions. It mentions 'target URL' which aligns with the required 'url' parameter, but provides no additional context about parameter usage, relationships, or best practices.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Start an active vulnerability scan') and the target ('on a target URL'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'zap.start_spider' which also initiates scanning activities, so it doesn't achieve the highest score for sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'zap.start_spider' or other security testing tools. There's no mention of prerequisites, typical use cases, or when this type of active scanning is appropriate versus other approaches.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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