Skip to main content
Glama
itunified-io

mcp-opnsense

by itunified-io

opnsense_diag_ping

Diagnose network connectivity by pinging a target from the OPNsense firewall. Accepts IP address or hostname with configurable packet count.

Instructions

Ping a host from the OPNsense firewall

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesIP address or hostname to ping
countNoNumber of ping packets (default: 3, max: 100)

Implementation Reference

  • Zod schema for ping input validation: requires 'address' (string), optional 'count' (1-100, default 3).
    const PingSchema = z.object({
      address: z.string().min(1, "Address is required"),
      count: z.number().int().min(1).max(100).optional().default(3),
    });
  • Tool definition registration for 'opnsense_diag_ping' — declares name, description, and inputSchema for the ListTools response.
    {
      name: "opnsense_diag_ping",
      description: "Ping a host from the OPNsense firewall",
      inputSchema: {
        type: "object" as const,
        properties: {
          address: {
            type: "string",
            description: "IP address or hostname to ping",
          },
          count: {
            type: "number",
            description: "Number of ping packets (default: 3, max: 100)",
          },
        },
        required: ["address"],
      },
    },
  • Core handler logic for 'opnsense_diag_ping': validates with PingSchema, then uses OPNsense 24.7+ job-based ping API (set→start→poll→remove). Polls until requested count reached, formats clean output with packet stats and RTT data.
    case "opnsense_diag_ping": {
      const parsed = PingSchema.parse(args);
    
      // OPNsense 24.7+: job-based ping API (set → start → poll → remove)
      const setResult = await client.post<{ uuid?: string; result?: string }>(
        "/diagnostics/ping/set",
        { ping: { settings: { hostname: parsed.address, count: String(parsed.count) } } },
      );
    
      const jobId = setResult.uuid;
      if (!jobId) {
        return { content: [{ type: "text", text: JSON.stringify(setResult, null, 2) }] };
      }
    
      await client.post(`/diagnostics/ping/start/${jobId}`);
    
      // Poll until send count reaches requested count (status stays "running" throughout)
      const maxWait = Math.max(parsed.count * 2000, 10000);
      const start = Date.now();
      let result: Record<string, unknown> | undefined;
      while (Date.now() - start < maxWait) {
        await new Promise((r) => setTimeout(r, 1500));
        const jobs = await client.get<{
          rows?: Array<Record<string, unknown>>;
        }>("/diagnostics/ping/search_jobs");
        const job = (jobs.rows ?? []).find(
          (j) => j.id === jobId || j.uuid === jobId,
        );
        if (job && Number(job.send ?? 0) >= parsed.count) {
          result = job;
          break;
        }
      }
    
      // Cleanup
      try {
        await client.post(`/diagnostics/ping/remove/${jobId}`);
      } catch {
        // Best-effort cleanup
      }
    
      if (!result) {
        return { content: [{ type: "text", text: "Ping timed out waiting for results" }] };
      }
    
      // Format clean output
      const output = {
        host: result.hostname,
        packets_sent: result.send,
        packets_received: result.received,
        packet_loss: result.loss,
        rtt_min_ms: result.min,
        rtt_avg_ms: result.avg,
        rtt_max_ms: result.max,
        rtt_stddev_ms: result["std-dev"],
      };
      return { content: [{ type: "text", text: JSON.stringify(output, null, 2) }] };
    }
  • src/index.ts:61-61 (registration)
    Maps the tool name 'opnsense_diag_ping' to its handler function in the central server registration.
    for (const def of diagnosticsToolDefinitions) toolHandlers.set(def.name, handleDiagnosticsTool);
Behavior2/5

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

No annotations are provided, yet the description fails to disclose behavioral traits such as permissions, side effects, or that it is a read-only operation, leaving a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single efficient sentence without wasted words, though it could provide slightly more context without becoming verbose.

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?

For a simple two-parameter tool with no output schema, the description is minimally adequate; it does not explain return values or expected output format, but ping behavior is widely understood.

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 description coverage is 100%, so the description adds no additional meaning beyond what is already in the schema, achieving the baseline 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 verb 'ping', resource 'host', and scope 'from the OPNsense firewall', distinguishing it from sibling diagnostic tools like dns_lookup and traceroute.

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?

The description implies usage for network connectivity testing but provides no explicit guidance on when to use this tool versus alternatives like traceroute or when not to use it.

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