Skip to main content
Glama

opnsense_get_rule_statistics

Read-onlyIdempotent

Retrieve per-rule pf counters from OPNsense to identify which firewall rules are used or unused. Filter by interface or label and flag rules with zero evaluations since the last apply.

Instructions

Get per-rule pf counters: how many times each rule was evaluated, and how many packets, bytes and states it accounted for.

This turns "which rules actually matter" into a data question. Counters reset every time the ruleset is reloaded, so a zero count means "not matched since the last apply", not "never matched". Confirm the ruleset has been stable for a while before concluding a rule is dead.

Args: params (RuleStatisticsInput): Validated input containing: - search (str): Filter on rule label or interface (default: "") - unused_only (bool): Only rules with zero evaluations (default: False) - limit (int): Max records, 1-200 (default: 25) - offset (int): Records to skip (default: 0) - response_format (ResponseFormat): 'markdown' or 'json'

Returns: str: Markdown table, or JSON with this schema: { "total": int, "count": int, "offset": int, "has_more": bool, "next_offset": int|null, "rule_stats": [ {"label": str, "evaluations": int, "packets": int, "bytes": int, "states": int, "interface": str} ] }

Examples: - Use when: "Which rules are never hit?" -> unused_only=True - Use when: "How much traffic does the guest block rule see?" -> search="guest"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

The description discloses a critical behavioral nuance: counters reset on every ruleset reload, making a zero count mean 'not matched since last apply' rather than 'never matched.' It also advises confirming ruleset stability before drawing conclusions—valuable context well beyond the readOnly/idempotent annotations.

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?

The description is well-structured with clear sections (overview, caveat, Args, Returns, Examples). It is front-loaded with the most important information and every sentence contributes value, including the illustrative examples that make usage immediately understandable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, the description is exceptionally complete: it covers purpose, parameter semantics, behavioral caveats, output schema, and concrete use cases. The existing output schema and annotations complement rather than replace this description.

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?

Despite the schema coverage signal showing 0%, the description fully documents every parameter (search, unused_only, limit, offset, response_format) and adds meaning beyond the schema by explaining the purpose of each and how to use them together. The included response schema further clarifies what each parameter influences.

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 opens with a specific, action-oriented summary: 'Get per-rule pf counters' and enumerates the exact metrics (evaluations, packets, bytes, states). This clearly differentiates it from related tools like opnsense_get_pf_statistics by emphasizing the per-rule granularity.

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 provides concrete 'Use when' examples tied to specific parameters (e.g., finding unused rules with unused_only=True, checking traffic on a specific rule with search). It gives clear context but does not explicitly name alternative tools or state when not to use this tool, so it stops short of a 5.

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/aesaganda/opnsense-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server