Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_diag_routes

Displays the current routing table to diagnose network paths and verify route configurations.

Instructions

Show the routing table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool definition (input schema) for opnsense_diag_routes — defines the tool name, description, and an empty inputSchema (no parameters).
    {
      name: "opnsense_diag_routes",
      description: "Show the routing table",
      inputSchema: { type: "object" as const, properties: {} },
    },
  • The handler function (handleDiagnosticsTool) case for 'opnsense_diag_routes' — calls client.get('/diagnostics/interface/getRoutes') and returns the routing table as JSON.
    export async function handleDiagnosticsTool(
      name: string,
      args: Record<string, unknown>,
      client: OPNsenseClient,
    ): Promise<{ content: Array<{ type: "text"; text: string }> }> {
      try {
        switch (name) {
          case "opnsense_diag_arp_table": {
            const filters = ArpFilterSchema.parse(args);
            const result = await client.get<unknown>("/diagnostics/interface/getArp");
    
            // Apply client-side filtering if any filter params provided
            if (filters.ip || filters.mac || filters.interface) {
              const entries = Array.isArray(result) ? result : [];
              const filtered = entries.filter((entry: Record<string, unknown>) => {
                if (filters.ip && !String(entry["ip"] ?? "").includes(filters.ip)) return false;
                if (filters.mac && !String(entry["mac"] ?? "").toLowerCase().includes(filters.mac.toLowerCase())) return false;
                if (filters.interface && String(entry["intf"] ?? "") !== filters.interface) return false;
                return true;
              });
              return { content: [{ type: "text", text: JSON.stringify(filtered, null, 2) }] };
            }
    
            return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
          }
    
          case "opnsense_diag_routes": {
            const result = await client.get("/diagnostics/interface/getRoutes");
            return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
          }
  • src/index.ts:39-52 (registration)
    Tool definitions are spread into allToolDefinitions from diagnosticsToolDefinitions (line 42). The handler is registered in the toolHandlers map at line 61.
    const allToolDefinitions = [
      ...dnsToolDefinitions,
      ...firewallToolDefinitions,
      ...diagnosticsToolDefinitions,
      ...interfacesToolDefinitions,
      ...dhcpToolDefinitions,
      ...systemToolDefinitions,
      ...acmeToolDefinitions,
      ...firmwareToolDefinitions,
      ...routingToolDefinitions,
      ...vlanToolDefinitions,
      ...tailscaleToolDefinitions,
      ...natToolDefinitions,
    ];
  • The client.get() method used by the handler — sends an HTTP GET request to the OPNsense API and returns the JSON response data.
    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}`);
      }
    }
Behavior2/5

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

With no annotations, the minimal description fails to disclose that this is a read-only diagnostic operation. It does not mention permissions, output format, or any side effects, requiring the agent to infer safety.

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?

A single concise sentence without any redundancy. Perfectly sized for a trivial zero-parameter read tool.

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?

Adequate for a simple diagnostic tool with no parameters or output schema. Could clarify it shows the current system routing table, but the current level is sufficient.

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 tool has no parameters, and the schema coverage is 100% (by default). The description adds no parameter info, but none is needed; baseline for 0 params is 4.

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 'Show the routing table' uses a specific verb ('Show') and resource ('routing table'), clearly distinguishing it from siblings like opnsense_route_list (configured routes) and opnsense_diag_arp_table (ARP table).

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives such as opnsense_route_list. It does not explain that it displays the dynamic/kernel routing table, not static routes, leaving potential confusion.

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