opnsense_vlan_update
Update an existing VLAN interface by specifying its UUID and only modifying the fields provided, such as parent interface, VLAN tag, description, or priority.
Instructions
Update an existing VLAN interface by UUID. Only provided fields are changed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes | UUID of the VLAN to update | |
| parent_interface | No | Parent physical interface device name | |
| vlan_tag | No | 802.1Q VLAN ID (1-4094) | |
| description | No | Description | |
| priority | No | 802.1p priority (0-7) |
Implementation Reference
- src/tools/vlan.ts:133-147 (handler)The handler for the 'opnsense_vlan_update' tool. It parses input via VlanUpdateSchema, builds a payload with only the fields provided, sends a POST to /interfaces/vlan_settings/setItem/{uuid}, then triggers reconfigure on the VLAN settings endpoint.
case "opnsense_vlan_update": { const parsed = VlanUpdateSchema.parse(args); const payload: Record<string, string> = {}; if (parsed.parent_interface !== undefined) payload["if"] = parsed.parent_interface; if (parsed.vlan_tag !== undefined) payload["tag"] = String(parsed.vlan_tag); if (parsed.description !== undefined) payload["descr"] = parsed.description; if (parsed.priority !== undefined) payload["pcp"] = String(parsed.priority); const result = await client.post( `/interfaces/vlan_settings/setItem/${parsed.uuid}`, { vlan: payload }, ); await client.post("/interfaces/vlan_settings/reconfigure"); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/tools/vlan.ts:18-24 (schema)Zod validation schema for the vlan_update tool input. Validates uuid (required), and optional fields: parent_interface, vlan_tag (1-4094), description, priority (0-7).
const VlanUpdateSchema = z.object({ uuid: UuidSchema, parent_interface: z.string().min(1).optional(), vlan_tag: z.number().int().min(1).max(4094).optional(), description: z.string().optional(), priority: z.number().int().min(0).max(7).optional(), }); - src/tools/vlan.ts:69-85 (registration)Tool definition/registration for 'opnsense_vlan_update' in the vlanToolDefinitions array. Defines name, description, and inputSchema (JSON Schema format) with uuid as required and all other fields optional.
name: "opnsense_vlan_update", description: "Update an existing VLAN interface by UUID. Only provided fields are changed.", inputSchema: { type: "object" as const, properties: { uuid: { type: "string", description: "UUID of the VLAN to update" }, parent_interface: { type: "string", description: "Parent physical interface device name", }, vlan_tag: { type: "number", description: "802.1Q VLAN ID (1-4094)" }, description: { type: "string", description: "Description" }, priority: { type: "number", description: "802.1p priority (0-7)" }, }, required: ["uuid"], }, - src/index.ts:35-35 (registration)Import of vlanToolDefinitions and handleVlanTool from the vlan module.
import { vlanToolDefinitions, handleVlanTool } from './tools/vlan.js'; - src/index.ts:49-49 (registration)vlanToolDefinitions spread into allToolDefinitions, which is returned by ListToolsRequestSchema handler.
...vlanToolDefinitions, - src/index.ts:68-68 (registration)Registration of handleVlanTool as the handler for all vlan tools in the toolHandlers map.
for (const def of vlanToolDefinitions) toolHandlers.set(def.name, handleVlanTool);