Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_if_get

Retrieve detailed configuration of a specific OPNsense network interface, including IP addresses, status, and MTU.

Instructions

Get detailed configuration for a specific network interface (IP addresses, status, MTU, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
interface_nameYesInterface name (e.g. 'lan', 'wan', 'opt1')

Implementation Reference

  • Handler function for the 'opnsense_if_get' tool. Parses args via GetInterfaceSchema, resolves the interface name (friendly or device name) using getInterfaceNames API, fetches detailed config from getInterfaceConfig API, and returns the result as JSON.
    case "opnsense_if_get": {
      const parsed = GetInterfaceSchema.parse(args);
      const input = parsed.interface_name.toLowerCase();
    
      // getInterfaceNames returns {device: friendly} e.g. {re0: "LAN", em0: "WAN"}
      // Resolve friendly name (e.g. "lan") to device name (e.g. "re0")
      const nameMap = await client.get<Record<string, string>>(
        "/diagnostics/interface/getInterfaceNames",
      );
    
      // Search: input could be a friendly name ("lan") or device name ("re0")
      let deviceName = parsed.interface_name;
      for (const [device, friendly] of Object.entries(nameMap)) {
        if (friendly.toLowerCase() === input || device.toLowerCase() === input) {
          deviceName = device;
          break;
        }
      }
    
      const allInterfaces = await client.get<Record<string, unknown>>(
        "/diagnostics/interface/getInterfaceConfig",
      );
    
      const interfaceData = allInterfaces[deviceName];
      if (!interfaceData) {
        const available = Object.entries(nameMap)
          .map(([device, friendly]) => `${friendly.toLowerCase()} (${device})`)
          .join(", ");
        return {
          content: [
            {
              type: "text",
              text: `Interface '${parsed.interface_name}' not found. Available: ${available}`,
            },
          ],
        };
      }
    
      return { content: [{ type: "text", text: JSON.stringify(interfaceData, null, 2) }] };
    }
  • Zod schema for validating the 'interface_name' input parameter (required non-empty string).
    const GetInterfaceSchema = z.object({
      interface_name: z.string().min(1, "Interface name is required"),
    });
  • Tool registration definition for 'opnsense_if_get' with name, description, and inputSchema requiring 'interface_name' string.
    {
      name: "opnsense_if_get",
      description:
        "Get detailed configuration for a specific network interface (IP addresses, status, MTU, etc.)",
      inputSchema: {
        type: "object" as const,
        properties: {
          interface_name: {
            type: "string",
            description: "Interface name (e.g. 'lan', 'wan', 'opt1')",
          },
        },
        required: ["interface_name"],
      },
    },
  • src/index.ts:62-62 (registration)
    Registration of handleInterfacesTool as the handler for all interfaces tools (including opnsense_if_get) in the toolHandlers map.
    for (const def of interfacesToolDefinitions) toolHandlers.set(def.name, handleInterfacesTool);
  • The OPNsenseClient.get() method used by the handler to call the OPNsense REST API endpoints (getInterfaceNames and getInterfaceConfig).
    async get<T>(path: string): Promise<T> {
      try {
        const response = await this.http.get<T>(path);
        return response.data;
      } catch (error: unknown) {
        throw extractError(error, `GET ${path}`);
      }
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It indicates a read operation via 'Get', but does not explicitly state it is read-only, has no side effects, or disclose any behavioral traits such as rate limits or required permissions.

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?

The description is a single, focused sentence that efficiently conveys the tool's purpose without redundant information.

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

Completeness4/5

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

Given the tool's simplicity (one parameter) and the absence of an output schema, the description provides enough context to understand the return fields. However, it does not specify the exact response structure, which could be helpful for an agent parsing the output.

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

Parameters4/5

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

The schema already describes the single parameter with examples, and the description adds context that it returns configuration details including IP addresses, status, MTU, etc. This supplements the schema well, though the description does not detail each parameter separately.

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 the tool retrieves detailed configuration for a specific network interface, listing example fields like IP addresses, status, and MTU. This distinguishes it from sibling tools like opnsense_if_list (which likely returns a summary list) and opnsense_if_stats (which may return statistics).

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

Usage Guidelines4/5

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

The description implies this tool is used when detailed configuration for a single interface is needed, as opposed to listing all interfaces or retrieving stats. However, it does not explicitly state when not to use it or provide alternative tool names.

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