create_target_list
Create and manage custom target lists of domains, IPs, or CIDR ranges for network security and filtering on the MCP-compatible Firewalla MSP firewall server.
Instructions
Create a new target list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Content category (optional) | |
| name | Yes | Target list name (required, max 24 chars) | |
| notes | No | Additional description (optional) | |
| owner | Yes | Owner: "global" or box GID (required) | |
| targets | Yes | Array of domains, IPs, or CIDR ranges (required) |
Implementation Reference
- src/tools/handlers/rules.ts:1516-1629 (handler)The CreateTargetListHandler class that extends BaseToolHandler and implements the core execution logic for creating a target list via Firewalla API. Includes input validation for name, owner, targets, category, notes and calls firewalla.createTargetList()export class CreateTargetListHandler extends BaseToolHandler { name = 'create_target_list'; description = 'Create a new target list in Firewalla'; category = 'rule' as const; constructor() { super({ enableGeoEnrichment: false, enableFieldNormalization: true, additionalMeta: { data_source: 'target_lists', entity_type: 'target_list_creation', supports_geographic_enrichment: false, supports_field_normalization: true, standardization_version: '2.0.0', }, }); } async execute( args: ToolArgs, firewalla: FirewallaClient ): Promise<ToolResponse> { try { const nameValidation = ParameterValidator.validateRequiredString( args?.name, 'name' ); const ownerValidation = ParameterValidator.validateRequiredString( args?.owner, 'owner' ); const targetsValidation = ParameterValidator.validateArray( args?.targets, 'targets', { required: true } ); const categoryValidation = ParameterValidator.validateEnum( args?.category, 'category', [ 'ad', 'edu', 'games', 'gamble', 'intel', 'p2p', 'porn', 'private', 'social', 'shopping', 'video', 'vpn', ], false ); const notesValidation = ParameterValidator.validateOptionalString( args?.notes, 'notes' ); const validationResult = ParameterValidator.combineValidationResults([ nameValidation, ownerValidation, targetsValidation, categoryValidation, notesValidation, ]); if (!validationResult.isValid) { return createErrorResponse( this.name, 'Parameter validation failed', ErrorType.VALIDATION_ERROR, undefined, validationResult.errors ); } const targetListData: any = { name: nameValidation.sanitizedValue, owner: ownerValidation.sanitizedValue, targets: targetsValidation.sanitizedValue, }; if (categoryValidation.sanitizedValue) { targetListData.category = categoryValidation.sanitizedValue; } if (notesValidation.sanitizedValue) { targetListData.notes = notesValidation.sanitizedValue; } const response = await withToolTimeout( async () => firewalla.createTargetList(targetListData), this.name ); return this.createUnifiedResponse(response); } catch (error: unknown) { if (error instanceof TimeoutError) { return createTimeoutErrorResponse(this.name, error.duration, 10000); } const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'; return createErrorResponse( this.name, `Failed to create target list: ${errorMessage}`, ErrorType.API_ERROR, { name: args?.name, owner: args?.owner } ); } } }
- src/tools/registry.ts:151-151 (registration)Registration of the CreateTargetListHandler instance in the ToolRegistry during automatic handler registrationthis.register(new CreateTargetListHandler());
- src/server.ts:324-370 (schema)Input schema definition for the create_target_list tool, specifying required parameters and validation rules used by the MCP servername: 'create_target_list', description: 'Create a new target list', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Target list name (required, max 24 chars)', maxLength: 24, }, owner: { type: 'string', description: 'Owner: "global" or box GID (required)', }, targets: { type: 'array', items: { type: 'string', }, description: 'Array of domains, IPs, or CIDR ranges (required)', }, category: { type: 'string', enum: [ 'ad', 'edu', 'games', 'gamble', 'intel', 'p2p', 'porn', 'private', 'social', 'shopping', 'video', 'vpn', ], description: 'Content category (optional)', }, notes: { type: 'string', description: 'Additional description (optional)', }, }, required: ['name', 'owner', 'targets'], },
- src/tools/registry.ts:46-56 (registration)Import statement for CreateTargetListHandler from rules.ts in the ToolRegistry file, enabling its registrationimport { GetNetworkRulesHandler, PauseRuleHandler, ResumeRuleHandler, GetTargetListsHandler, GetSpecificTargetListHandler, CreateTargetListHandler, UpdateTargetListHandler, DeleteTargetListHandler, GetNetworkRulesSummaryHandler, } from './handlers/rules.js';