delete_firewall_rule
Remove a specific firewall rule on an OPNSense firewall by providing its UUID. Simplifies firewall rule management and enhances network security.
Instructions
Delete a firewall rule
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | Firewall rule UUID |
Implementation Reference
- The main handler function for the firewall delete tool. It performs an API POST to delete the rule by UUID, applies changes, emits an event, updates the cache, and returns success status.private async deleteRule(params: { uuid: string }): Promise<any> { try { const response = await this.api.post(`/api/firewall/filter/delRule/${params.uuid}`); if (response.data?.result === 'deleted') { // Apply changes await this.applyChanges({}); // Emit event this.emit('firewall.rule.deleted', { uuid: params.uuid, }); // Remove from cache this.ruleCache.delete(params.uuid); return { success: true, message: 'Firewall rule deleted successfully', }; } throw new Error('Failed to delete firewall rule'); } catch (error) { this.logger.error(`Error deleting firewall rule ${params.uuid}:`, error); throw error; }
- Input schema for the 'firewall_delete_rule' tool, requiring a 'uuid' string parameter.inputSchema: { type: 'object', properties: { uuid: { type: 'string', description: 'Rule UUID', }, }, required: ['uuid'],
- src/plugins/core/core-firewall/index.ts:152-166 (registration)Registration of the 'firewall_delete_rule' tool within the getTools() method of the FirewallPlugin, including name, description, schema, and handler binding.{ name: 'firewall_delete_rule', description: 'Delete a firewall rule', inputSchema: { type: 'object', properties: { uuid: { type: 'string', description: 'Rule UUID', }, }, required: ['uuid'], }, handler: this.deleteRule.bind(this), },