Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_dhcp_list_leases

Retrieve a list of active DHCPv4 leases from OPNsense. Automatically detects and supports both Kea and ISC DHCP backends for compatibility.

Instructions

List all current DHCPv4 leases. Supports both Kea DHCP (default on modern OPNsense) and ISC DHCP (legacy) backends — auto-detects which is active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for opnsense_dhcp_list_leases - tries Kea DHCP leases endpoint first, falls back to ISC DHCP if Kea is unavailable.
    case "opnsense_dhcp_list_leases": {
      // Try Kea first (the modern OPNsense default). If Kea endpoint 404s
      // (plugin not installed) fall back to ISC dhcpd. This matches the
      // backend-detection pattern used for static reservations and fixes
      // #131 — without this, Kea-backed installs returned empty arrays
      // even when active leases were visible in the OPNsense UI.
      try {
        const result = await keaListLeases(client);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      } catch {
        const result = await iscListLeases(client);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    }
  • Helper that calls Kea DHCP leases API endpoint at /kea/leases4/search
    async function keaListLeases(client: OPNsenseClient): Promise<unknown> {
      return await client.get("/kea/leases4/search");
    }
  • Helper that calls ISC DHCP (legacy) leases API endpoint at /dhcpv4/leases/searchLease
    async function iscListLeases(client: OPNsenseClient): Promise<unknown> {
      return await client.get("/dhcpv4/leases/searchLease");
    }
  • Tool definition/registration for opnsense_dhcp_list_leases with no input parameters
    {
      name: "opnsense_dhcp_list_leases",
      description:
        "List all current DHCPv4 leases. Supports both Kea DHCP (default on modern OPNsense) and ISC DHCP (legacy) backends — auto-detects which is active.",
      inputSchema: { type: "object" as const, properties: {} },
    },
  • src/index.ts:63-63 (registration)
    Maps the dhcpToolDefinitions (including opnsense_dhcp_list_leases) to the handleDhcpTool handler in the server registration
    for (const def of dhcpToolDefinitions) toolHandlers.set(def.name, handleDhcpTool);
Behavior3/5

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

With no annotations, the description must disclose behavioral traits. It states it lists leases and auto-detects backends, but does not explicitly note it is read-only or non-destructive. For a simple list tool, this is minimally adequate.

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 concise sentences with no extraneous information. The description is front-loaded with the core action and efficiently adds backend details.

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 covers the core purpose and backend handling, but lacks details on output format, prerequisites, or any side effects. Given no output schema, more context would be helpful.

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 input schema has no parameters, so the description cannot add parameter semantics. However, it adds value by explaining backend support beyond the empty schema, earning a high score.

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 lists DHCPv4 leases and specifies support for both Kea and ISC backends. It distinguishes from siblings like find_lease and static lease tools.

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 explicitly covers backend auto-detection, useful for users unsure which DHCP is active. However, it does not mention when to avoid this tool in favor of siblings like opnsense_dhcp_find_lease.

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