opnsense_nat_source_delete
Remove a source NAT rule by UUID. Requires explicit confirmation to prevent accidental deletion.
Instructions
Delete a Source NAT rule. DESTRUCTIVE: requires explicit confirmation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | Rule UUID | |
| confirm | Yes |
Implementation Reference
- src/tools/nat.ts:315-321 (handler)The handler for the 'opnsense_nat_source_delete' tool. Parses args with SourceNatUuidConfirmSchema (uuid + confirm), then calls the OPNsense API endpoint /firewall/source_nat/del_rule/{uuid} via POST.
case "opnsense_nat_source_delete": { const p = SourceNatUuidConfirmSchema.parse(args); const result = await client.post( `/firewall/source_nat/del_rule/${encodeURIComponent(p.uuid)}`, ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/tools/nat.ts:74-77 (schema)The input validation schema (SourceNatUuidConfirmSchema) used by the delete handler. Requires a valid UUID and a confirm field that must be true.
const SourceNatUuidConfirmSchema = z.object({ uuid: UuidSchema, confirm: ConfirmTrue("confirm must be true to proceed"), }); - src/tools/nat.ts:169-180 (registration)The tool definition registration for 'opnsense_nat_source_delete' in the natToolDefinitions array, including its name, description, and input JSON schema.
{ name: "opnsense_nat_source_delete", description: "Delete a Source NAT rule. DESTRUCTIVE: requires explicit confirmation.", inputSchema: { type: "object" as const, properties: { uuid: { type: "string", description: "Rule UUID" }, confirm: { type: "boolean", enum: [true] }, }, required: ["uuid", "confirm"], }, }, - src/index.ts:70-70 (registration)The tool handler is registered in the MCP server's toolHandlers map by matching the definition name to the handleNatTool function.
for (const def of natToolDefinitions) toolHandlers.set(def.name, handleNatTool); - src/utils/validation.ts:3-5 (helper)The UuidSchema helper used by SourceNatUuidConfirmSchema to validate that the uuid parameter is a valid UUID.
export const UuidSchema = z .string() .uuid("Invalid UUID format");