opnsense_firmware_reboot
Reboot the OPNsense firewall to apply firmware updates or resolve system issues. Requires explicit confirmation due to network outage.
Instructions
Reboot the OPNsense system. Causes a network outage on the firewall and any services it provides (DNS, DHCP, VPN). DESTRUCTIVE: requires explicit confirmation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | Yes | Must be true to confirm the reboot |
Implementation Reference
- src/tools/firmware.ts:193-197 (handler)The handler for the opnsense_firmware_reboot tool. It validates the 'confirm' parameter via RebootSchema, then POSTs to '/core/firmware/reboot' via the OPNsense REST API client.
case "opnsense_firmware_reboot": { RebootSchema.parse(args); const result = await client.post("/core/firmware/reboot"); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/tools/firmware.ts:29-31 (schema)The Zod schema (RebootSchema) that validates the 'confirm' parameter must be the literal boolean true. Uses ConfirmTrue helper that coerces 'true' string to boolean true before validation.
const RebootSchema = z.object({ confirm: ConfirmTrue("confirm must be true to proceed with the reboot"), }); - src/tools/firmware.ts:119-134 (registration)The tool definition registration in the firmwareToolDefinitions array. Defines the tool's name, description, and inputSchema (confirm boolean). This is exported and then added to the allToolDefinitions array in src/index.ts.
{ name: "opnsense_firmware_reboot", description: "Reboot the OPNsense system. Causes a network outage on the firewall and any services it provides (DNS, DHCP, VPN). DESTRUCTIVE: requires explicit confirmation.", inputSchema: { type: "object" as const, properties: { confirm: { type: "boolean", description: "Must be true to confirm the reboot", enum: [true], }, }, required: ["confirm"], }, }, - src/tools/firmware.ts:14-18 (helper)The ConfirmTrue helper used by RebootSchema. It preprocesses input by coercing the string 'true' to a boolean true (for MCP transport serialization), then validates that the value is the literal true.
const ConfirmTrue = (msg: string) => z.preprocess( (v) => (v === "true" ? true : v === "false" ? false : v), z.literal(true, { errorMap: () => ({ message: msg }) }), ); - src/index.ts:66-66 (registration)The handler registration in src/index.ts - maps the tool name 'opnsense_firmware_reboot' (via firmwareToolDefinitions) to the handleFirmwareTool handler function.
for (const def of firmwareToolDefinitions) toolHandlers.set(def.name, handleFirmwareTool);