confirm and dry_run—are built into every mutating tool. All operations, successful or not, are written to an audit log for accountability and troubleshooting.
Confirmation required: confirm=True
Every tool that creates, updates, or deletes a resource requires you to pass confirm=True explicitly. If you omit this flag or pass confirm=False, the tool returns a ConfirmationRequiredError and makes no changes.
This design prevents an AI agent from accidentally modifying your network in response to an ambiguous prompt. The confirmation flag must be intentional—it cannot be inferred or defaulted.
Dry-run preview: dry_run=True
Passing dry_run=True to any mutating tool shows you exactly what the operation would do—without actually applying any changes. The tool returns a preview of the configuration that would be sent to the UniFi API.
dry_run=True takes precedence over confirm=True, so passing both is a safe way to preview.
Audit logging
Every tool call—reads and writes alike—is appended toaudit.log in the working directory. The log records the tool name, parameters, outcome, and a timestamp. Sensitive values such as passwords and API keys are automatically masked before writing.
Example audit.log entries:
logrotate if needed.
Input validation
All tool parameters are validated using Pydantic models before any API call is made. Validation catches:- Missing required fields
- Values outside allowed ranges (for example, VLAN IDs must be between 1 and 4094)
- Invalid formats (MAC addresses, IP subnets, SSID names)
- Unsupported enum values (security types, protocol names)
ValidationError is returned with a detailed message describing which parameter failed and why, before any network request is made.
Password masking
Any tool parameter that appears to contain a credential—includingpassword, api_key, secret, and similar field names—is replaced with ***MASKED*** in all log output, including the audit log and debug logs. The actual value is never written to disk.
This applies to WiFi passwords in create_wlan and update_wlan, RADIUS secrets, and any other sensitive string fields.