opnsense_tailscale_service_control
Manage the Tailscale service on OPNsense: start, stop, restart, or apply configuration changes.
Instructions
Control the Tailscale service: start, stop, restart, or reconfigure (apply settings changes).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Service action to perform |
Implementation Reference
- src/tools/tailscale.ts:30-34 (schema)Zod schema (TailscaleServiceActionSchema) validating the 'action' parameter for the service control tool, requiring one of: start, stop, restart, reconfigure.
const TailscaleServiceActionSchema = z.object({ action: z.enum(["start", "stop", "restart", "reconfigure"], { errorMap: () => ({ message: "action must be one of: start, stop, restart, reconfigure" }), }), }); - src/tools/tailscale.ts:91-106 (registration)Tool definition for 'opnsense_tailscale_service_control' with its name, description, and inputSchema (JSON Schema format).
{ name: "opnsense_tailscale_service_control", description: "Control the Tailscale service: start, stop, restart, or reconfigure (apply settings changes).", inputSchema: { type: "object" as const, properties: { action: { type: "string", enum: ["start", "stop", "restart", "reconfigure"], description: "Service action to perform", }, }, required: ["action"], }, }, - src/tools/tailscale.ts:148-152 (handler)Handler case for 'opnsense_tailscale_service_control' — parses args with the Zod schema and POSTs to /tailscale/service/{action}.
case "opnsense_tailscale_service_control": { const parsed = TailscaleServiceActionSchema.parse(args); const result = await client.post(`/tailscale/service/${parsed.action}`, {}); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - src/index.ts:69-69 (registration)Registration of tailscale tool definitions into the toolHandlers map — maps the tool name to handleTailscaleTool handler function.
for (const def of tailscaleToolDefinitions) toolHandlers.set(def.name, handleTailscaleTool); - src/tools/tailscale.ts:164-167 (helper)Error handling wrapper that catches any errors and returns a formatted error message in the response.
} catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error: ${message}` }] }; }