Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_diag_fw_states

Display all active firewall connection tracking states to monitor current network flows and diagnose firewall performance.

Instructions

List active firewall connection tracking states

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool definition/registration for opnsense_diag_fw_states in diagnosticsToolDefinitions array — declares the tool name, description, and empty input schema to the MCP ListTools protocol.
    {
      name: "opnsense_diag_fw_states",
      description: "List active firewall connection tracking states",
      inputSchema: { type: "object" as const, properties: {} },
    },
  • Handler logic for opnsense_diag_fw_states — calls OPNsense API endpoint /diagnostics/firewall/query_states via POST and returns the result as JSON.
    case "opnsense_diag_fw_states": {
      const result = await client.post("/diagnostics/firewall/query_states");
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • src/index.ts:61-61 (registration)
    Registration of the diagnostics tool handler function (including opnsense_diag_fw_states) into the MCP server's tool handler map.
    for (const def of diagnosticsToolDefinitions) toolHandlers.set(def.name, handleDiagnosticsTool);
  • src/index.ts:42-42 (registration)
    Diagnostics tool definitions (including opnsense_diag_fw_states) spread into the allToolDefinitions array for ListTools response.
    ...diagnosticsToolDefinitions,
  • The OPNsenseClient.post() method used by the handler to send the HTTP POST request to the OPNsense API.
      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 });
      }
    }
Behavior3/5

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

No annotations provided, so description carries full burden. It indicates a read-only listing operation, which is safe and non-destructive, but lacks details on potential performance impact or authorization requirements.

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?

Single sentence description is concise and front-loaded with key information. No wasted words.

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?

For a simple list tool with no parameters, the description is complete. It could mention that it returns state table entries, but the name and description already imply that.

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

Parameters5/5

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

The tool has zero parameters, so no parameter documentation is needed. The description is sufficient.

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 'List active firewall connection tracking states' clearly states the tool's purpose with a specific verb (List), resource (firewall connection tracking states), and action. It effectively differentiates from sibling diagnostic tools like ARP table listing.

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?

No explicit guidance on when to use this versus other diagnostic tools. However, the name and description imply usage for inspecting current firewall states, which is adequate for a zero-parameter tool.

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