Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_dhcp_find_lease

Search for DHCPv4 leases using an IP address, MAC address, or hostname. Automatically detects whether Kea or ISC DHCP is active.

Instructions

Search DHCPv4 leases by IP address, MAC address, or hostname. Supports both Kea DHCP and ISC DHCP (legacy) backends — auto-detects which is active.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch term — IP address, MAC address, or hostname

Implementation Reference

  • Handler case for 'opnsense_dhcp_find_lease' in handleDhcpTool. It validates input with FindLeaseSchema, then tries to find the lease via Kea backend; if that fails (Kea plugin not installed), it falls back to ISC DHCP backend.
    case "opnsense_dhcp_find_lease": {
      const parsed = FindLeaseSchema.parse(args);
      try {
        const result = await keaFindLease(client, parsed.query);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      } catch {
        const result = await iscFindLease(client, parsed.query);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    }
  • Kea backend helper: keaFindLease queries /kea/leases4/search with the searchPhrase parameter.
    async function keaFindLease(client: OPNsenseClient, query: string): Promise<unknown> {
      return await client.get(
        `/kea/leases4/search?searchPhrase=${encodeURIComponent(query)}`,
      );
    }
  • ISC DHCP (legacy) backend helper: iscFindLease queries /dhcpv4/leases/searchLease with the searchPhrase parameter.
    async function iscFindLease(client: OPNsenseClient, query: string): Promise<unknown> {
      return await client.get(
        `/dhcpv4/leases/searchLease?searchPhrase=${encodeURIComponent(query)}`,
      );
    }
  • Zod schema FindLeaseSchema that validates the input: requires a non-empty string 'query' for searching leases by IP, MAC, or hostname.
    const FindLeaseSchema = z.object({
      query: z.string().min(1, "Search query is required (IP, MAC, or hostname)"),
    });
  • Tool definition registration in dhcpToolDefinitions array: defines the tool name 'opnsense_dhcp_find_lease', description, and input schema with required 'query' string property.
    {
      name: "opnsense_dhcp_find_lease",
      description:
        "Search DHCPv4 leases by IP address, MAC address, or hostname. Supports both Kea DHCP and ISC DHCP (legacy) backends — auto-detects which is active.",
      inputSchema: {
        type: "object" as const,
        properties: {
          query: {
            type: "string",
            description: "Search term — IP address, MAC address, or hostname",
          },
        },
        required: ["query"],
      },
    },
Behavior3/5

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

Discloses backend support and auto-detection behavior, which is valuable. However, with no annotations, the description carries full burden. It does not mention read-only nature, return format, or error handling, leaving some behavioral gaps.

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 efficient sentences with no wasted words. The key information is front-loaded, and every sentence serves a purpose.

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 simplicity of the tool and no output schema, the description is fairly complete. It covers purpose, search criteria, and backend handling. Missing details on return format (single vs multiple) and error responses, but overall adequate for a one-param search tool.

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 a clear parameter description matching the tool description. Description adds no new meaning beyond what the schema already provides, so baseline 3 is appropriate.

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?

Description clearly states the verb 'Search' and the resource 'DHCPv4 leases' with specific searchable attributes (IP, MAC, hostname). It also differentiates from sibling tools like list_leases by implying a focused search operation.

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?

Provides clear context on what it searches and mentions backend auto-detection, but does not explicitly state when to use this tool versus alternatives like list_leases or when not to use it. The context is clear but lacks explicit exclusions.

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