Skip to main content
Glama

zap.include_in_context

Add URL patterns to security testing contexts for automated vulnerability scanning and reconnaissance in bug bounty workflows.

Instructions

Include a URL pattern in a context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNameYesContext name
regexYesURL regex pattern to include

Implementation Reference

  • The MCP tool handler function for 'zap.include_in_context'. It retrieves the ZAP client and calls includeInContext on it, formatting the result.
    async ({ contextName, regex }: any): Promise<ToolResult> => { const client = getZAPClient(); if (!client) { return formatToolResult(false, null, 'ZAP client not initialized'); } const result = await client.includeInContext(contextName, regex); return formatToolResult(result.success, result.data, result.error); }
  • Input schema definition for the 'zap.include_in_context' tool, specifying contextName and regex parameters.
    inputSchema: { type: 'object', properties: { contextName: { type: 'string', description: 'Context name', }, regex: { type: 'string', description: 'URL regex pattern to include', }, }, required: ['contextName', 'regex'], },
  • Registration of the 'zap.include_in_context' tool using server.tool, including name, schema, and handler.
    'zap.include_in_context', { description: 'Include a URL pattern in a context', inputSchema: { type: 'object', properties: { contextName: { type: 'string', description: 'Context name', }, regex: { type: 'string', description: 'URL regex pattern to include', }, }, required: ['contextName', 'regex'], }, }, async ({ contextName, regex }: any): Promise<ToolResult> => { const client = getZAPClient(); if (!client) { return formatToolResult(false, null, 'ZAP client not initialized'); } const result = await client.includeInContext(contextName, regex); return formatToolResult(result.success, result.data, result.error); } );
  • ZAPClient helper method that implements the core logic by calling ZAP's REST API endpoint /context/action/includeInContext/ with fallback for contextId.
    async includeInContext(contextName: string, regex: string): Promise<ZAPScanResult> { try { // First try with contextName, if that fails and we have a numeric contextName, try as contextId try { const response = await this.client.get('/context/action/includeInContext/', { params: { contextName, regex }, }); return { success: true, data: response.data, }; } catch (error: any) { // If contextName fails and it's numeric, try as contextId if (!isNaN(Number(contextName))) { const response = await this.client.get('/context/action/includeInContext/', { params: { contextId: contextName, regex }, }); return { success: true, data: response.data, }; } throw error; } } catch (error: any) { return { success: false, error: error.message || 'Failed to include URL in context', }; } }

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