Skip to main content
Glama

zap.create_context

Create a scanning context in ZAP to organize and manage security testing sessions for vulnerability assessment.

Instructions

Create a scanning context in ZAP

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNameYesName for the context

Implementation Reference

  • Core handler logic that performs the HTTP request to ZAP's API endpoint /context/action/newContext/ to create a new scanning context.
    async createContext(contextName: string): Promise<ZAPScanResult> { try { const response = await this.client.get('/context/action/newContext/', { params: { contextName }, }); return { success: true, data: { contextId: parseInt(response.data.contextId), name: contextName, }, }; } catch (error: any) { return { success: false, error: error.message || 'Failed to create context', }; } }
  • MCP tool registration including input schema, description, and wrapper handler that initializes ZAP client and calls the core createContext method.
    'zap.create_context', { description: 'Create a scanning context in ZAP', inputSchema: { type: 'object', properties: { contextName: { type: 'string', description: 'Name for the context', }, }, required: ['contextName'], }, }, async ({ contextName }: any): Promise<ToolResult> => { const client = getZAPClient(); if (!client) { return formatToolResult(false, null, 'ZAP client not initialized'); } const result = await client.createContext(contextName); return formatToolResult(result.success, result.data, result.error); } );
  • src/index.ts:49-49 (registration)
    Top-level registration call that invokes registerZAPTools to add all ZAP tools, including zap.create_context, to the MCP server.
    registerZAPTools(server);
  • Type definition for the return type of ZAP API calls, used by createContext and the tool handler.
    export interface ZAPScanResult { success: boolean; data?: any; error?: string; }

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