Skip to main content
Glama

update_firewall_rule

Modify firewall rule settings such as source, destination, ports, and description on OPNSense MCP Server using the rule's UUID for precise configuration updates.

Instructions

Update a firewall rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoNew description
destinationNoNew destination
destinationPortNoNew destination port
enabledNoEnable/disable rule
sourceNoNew source
sourcePortNoNew source port
uuidYesFirewall rule UUID

Implementation Reference

  • Registration of the 'firewall_update_rule' MCP tool, including name, description, input schema requiring uuid and rule object, and handler binding
    name: 'firewall_update_rule', description: 'Update an existing firewall rule', inputSchema: { type: 'object', properties: { uuid: { type: 'string', description: 'Rule UUID', }, rule: { type: 'object', description: 'Rule properties to update', }, }, required: ['uuid', 'rule'], }, handler: this.updateRule.bind(this), },
  • Handler function that updates a firewall rule via OPNsense API endpoint `/api/firewall/filter/setRule/{uuid}`, applies changes, emits 'firewall.rule.updated' event, invalidates rule cache, and returns success response or throws error.
    private async updateRule(params: { uuid: string; rule: any }): Promise<any> { try { const response = await this.api.post( `/api/firewall/filter/setRule/${params.uuid}`, { rule: params.rule } ); if (response.data?.result === 'saved') { // Apply changes await this.applyChanges({}); // Emit event this.emit('firewall.rule.updated', { uuid: params.uuid, changes: params.rule, }); // Invalidate cache this.ruleCache.delete(params.uuid); return { success: true, message: 'Firewall rule updated successfully', }; } throw new Error('Failed to update firewall rule'); } catch (error) { this.logger.error(`Error updating firewall rule ${params.uuid}:`, error); throw error; } }

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/vespo92/OPNSenseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server