Skip to main content
Glama

zap.include_in_context

Add URL patterns to security testing contexts for automated vulnerability scanning 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

  • MCP tool handler for 'zap.include_in_context'. Retrieves ZAP client and delegates to client.includeInContext(contextName, regex), 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 defining required parameters: contextName (string) and regex (string) for including URL patterns in ZAP context.
    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' MCP tool using server.tool(), providing description, input schema, and inline handler function.
    server.tool( '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.includeInContext helper method that makes API call to ZAP's /context/action/includeInContext/ endpoint, handling both contextName and 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