toggle_blocklist_entry
Enable or disable a DNS blocklist entry in OPNSense by specifying the UUID of the entry using the MCP server for efficient firewall management.
Instructions
Enable/disable a DNS blocklist entry
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | UUID of the blocklist entry |
Implementation Reference
- The core handler function that toggles the enabled/disabled state of a specific DNS blocklist entry identified by its UUID. It fetches the current entry, flips the 'enabled' flag between '0' and '1', updates it via the OPNSense API client, and applies the changes.async toggleBlocklistEntry(uuid: string): Promise<void> { try { const entry = await this.client.getUnboundHost(uuid); if (!entry?.host) { throw new Error('Blocklist entry not found'); } const updated = { ...entry.host, enabled: entry.host.enabled === '1' ? '0' : '1' }; await this.client.setUnboundHost(uuid, updated); await this.applyChanges(); } catch (error: any) { console.error('Failed to toggle blocklist entry:', error); throw new Error(`Failed to toggle blocklist entry: ${error.message}`); } }