opnsense_nat_apply
Apply pending NAT configuration changes in OPNsense. Required after adding, updating, or deleting NAT rules to make changes active. Destructive operation requires confirmation.
Instructions
Apply pending NAT configuration changes. Required after add/update/delete/toggle for changes to take effect. DESTRUCTIVE.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | Yes |
Implementation Reference
- src/tools/nat.ts:193-204 (registration)Registration of the opnsense_nat_apply tool definition with name, description, and inputSchema (confirm required).
{ name: "opnsense_nat_apply", description: "Apply pending NAT configuration changes. Required after add/update/delete/toggle for changes to take effect. DESTRUCTIVE.", inputSchema: { type: "object" as const, properties: { confirm: { type: "boolean", enum: [true] }, }, required: ["confirm"], }, }, - src/tools/nat.ts:79-81 (schema)Zod schema for the apply tool: validates that confirm is exactly true.
const ApplySchema = z.object({ confirm: ConfirmTrue("confirm must be true to apply NAT configuration"), }); - src/tools/nat.ts:331-335 (handler)Handler for opnsense_nat_apply: validates args with ApplySchema, then POSTs to /firewall/source_nat/apply to apply pending NAT changes.
case "opnsense_nat_apply": { ApplySchema.parse(args); const result = await client.post("/firewall/source_nat/apply", {}); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/tools/nat.ts:8-12 (helper)Helper function that coerces string booleans and validates that the value is exactly true, used by ApplySchema.
const ConfirmTrue = (msg: string) => z.preprocess( (v) => (v === "true" ? true : v === "false" ? false : v), z.literal(true, { errorMap: () => ({ message: msg }) }), );