Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_tailscale_settings_set

Configure Tailscale settings on OPNsense: enable, port, auth key, routes, exit node, accept routes, DNS. Reconfigure required to apply.

Instructions

Update Tailscale plugin settings. Only provided fields are changed. Run opnsense_tailscale_service_control with action 'reconfigure' afterwards to apply.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
enabledNoEnable (1) or disable (0) the Tailscale service
portNoUDP port for Tailscale (default: 41641)
auth_keyNoTailscale auth key for automatic enrollment
advertise_routesNoComma-separated CIDR list to advertise as subnet routes (e.g. '10.10.0.0/24')
advertise_exit_nodeNoAdvertise as exit node (1) or not (0)
accept_routesNoAccept routes from other nodes (1) or not (0)
accept_dnsNoAccept DNS configuration from tailnet (1) or not (0)

Implementation Reference

  • Handler for opnsense_tailscale_settings_set: parses input via Zod schema, builds a settings object with only the provided fields, then POSTs to the OPNsense API endpoint /tailscale/settings/set
    case "opnsense_tailscale_settings_set": {
      const parsed = TailscaleSettingsSetSchema.parse(args);
      const settings: Record<string, string> = {};
      if (parsed.enabled !== undefined) settings.enabled = parsed.enabled;
      if (parsed.port !== undefined) settings.port = parsed.port;
      if (parsed.auth_key !== undefined) settings.auth_key = parsed.auth_key;
      if (parsed.advertise_routes !== undefined) settings.advertise_routes = parsed.advertise_routes;
      if (parsed.advertise_exit_node !== undefined) settings.advertise_exit_node = parsed.advertise_exit_node;
      if (parsed.accept_routes !== undefined) settings.accept_routes = parsed.accept_routes;
      if (parsed.accept_dns !== undefined) settings.accept_dns = parsed.accept_dns;
    
      const result = await client.post("/tailscale/settings/set", { settings });
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Zod schema for validating input to opnsense_tailscale_settings_set, with boolean coercion preprocessors for enabled/advertise_exit_node/accept_routes/accept_dns
    const TailscaleSettingsSetSchema = z.object({
      enabled: z.preprocess(
        (v) => (v === "true" || v === true || v === "1" ? "1" : v === "false" || v === false || v === "0" ? "0" : v),
        z.enum(["0", "1"]).optional(),
      ),
      port: z.string().regex(/^\d+$/, "Port must be a numeric string").optional(),
      auth_key: z.string().optional().describe("Tailscale auth key for automatic enrollment"),
      advertise_routes: z.string().optional().describe("Comma-separated CIDR list to advertise (e.g. '10.10.0.0/24,10.10.20.0/24')"),
      advertise_exit_node: z.preprocess(
        (v) => (v === "true" || v === true || v === "1" ? "1" : v === "false" || v === false || v === "0" ? "0" : v),
        z.enum(["0", "1"]).optional(),
      ),
      accept_routes: z.preprocess(
        (v) => (v === "true" || v === true || v === "1" ? "1" : v === "false" || v === false || v === "0" ? "0" : v),
        z.enum(["0", "1"]).optional(),
      ),
      accept_dns: z.preprocess(
        (v) => (v === "true" || v === true || v === "1" ? "1" : v === "false" || v === false || v === "0" ? "0" : v),
        z.enum(["0", "1"]).optional(),
      ),
    });
  • Tool definition registration for opnsense_tailscale_settings_set in the tailscaleToolDefinitions array, providing name, description, and JSON Schema input definition
    {
      name: "opnsense_tailscale_settings_set",
      description:
        "Update Tailscale plugin settings. Only provided fields are changed. Run opnsense_tailscale_service_control with action 'reconfigure' afterwards to apply.",
      inputSchema: {
        type: "object" as const,
        properties: {
          enabled: {
            type: "string",
            enum: ["0", "1"],
            description: "Enable (1) or disable (0) the Tailscale service",
          },
          port: {
            type: "string",
            description: "UDP port for Tailscale (default: 41641)",
          },
          auth_key: {
            type: "string",
            description: "Tailscale auth key for automatic enrollment",
          },
          advertise_routes: {
            type: "string",
            description: "Comma-separated CIDR list to advertise as subnet routes (e.g. '10.10.0.0/24')",
          },
          advertise_exit_node: {
            type: "string",
            enum: ["0", "1"],
            description: "Advertise as exit node (1) or not (0)",
          },
          accept_routes: {
            type: "string",
            enum: ["0", "1"],
            description: "Accept routes from other nodes (1) or not (0)",
          },
          accept_dns: {
            type: "string",
            enum: ["0", "1"],
            description: "Accept DNS configuration from tailnet (1) or not (0)",
          },
        },
      },
    },
  • OPNsenseClient.post() helper used by the tool handler to send settings to the /tailscale/settings/set API endpoint
      async post<T>(path: string, data?: unknown): Promise<T> {
        try {
          const response = await this.http.post<T>(path, data ?? {}, {
            headers: { "Content-Type": "application/json" },
          });
          return response.data;
        } catch (error: unknown) {
          throw extractError(error, `POST ${path}`);
        }
      }
    
      async delete<T>(path: string): Promise<T> {
        try {
          const response = await this.http.delete<T>(path);
          return response.data;
        } catch (error: unknown) {
          throw extractError(error, `DELETE ${path}`);
        }
      }
    
      static fromEnv(): OPNsenseClient {
        const url = process.env["OPNSENSE_URL"];
        const apiKey = process.env["OPNSENSE_API_KEY"];
        const apiSecret = process.env["OPNSENSE_API_SECRET"];
    
        if (!url) throw new Error("OPNSENSE_URL environment variable is required");
        if (!apiKey) throw new Error("OPNSENSE_API_KEY environment variable is required");
        if (!apiSecret) throw new Error("OPNSENSE_API_SECRET environment variable is required");
    
        const verifySsl = process.env["OPNSENSE_VERIFY_SSL"] !== "false";
        const timeout = parseInt(process.env["OPNSENSE_TIMEOUT"] ?? "30000", 10);
    
        return new OPNsenseClient({ url, apiKey, apiSecret, verifySsl, timeout });
      }
    }
  • src/index.ts:69-69 (registration)
    Maps the opnsense_tailscale_settings_set tool name to the handleTailscaleTool handler in the central toolHandlers registry
    for (const def of tailscaleToolDefinitions) toolHandlers.set(def.name, handleTailscaleTool);
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It mentions the partial update behavior and the need for reconfiguration, but does not disclose idempotency, validation, error behavior, or side effects beyond the note. Adequate but not thorough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no fluff. The first sentence states the action and resource, the second provides essential post-step instruction. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description omits return value or output behavior. It does not mention whether the operation is synchronous or what it returns (e.g., success status). The post-step is included, but overall completeness is average for a set tool with 7 parameters and no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with individual parameter descriptions. The description adds no further semantic detail beyond reinforcing that only provided fields change. Baseline 3 is appropriate as the schema already covers the parameters well.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Update Tailscale plugin settings' which specifies the verb and resource. It also notes that only provided fields are changed, distinguishing it from a full replacement. The sibling tools include a getter and service control, so the purpose is well-defined.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a critical post-step (run service reconfigure) but lacks explicit guidance on when to use this tool versus alternatives. There is no mention of when not to use it or references to sibling tools like the getter or service control for other actions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/itunified-io/mcp-opnsense'

If you have feedback or need assistance with the MCP directory API, please join our Discord server