Skip to main content
Glama

rule_hit_and_shadow_analysis

Read-only

Detect never-hit, shadowed, and redundant firewall rules by comparing top-down order and evaluation counts to find dead, covered, or duplicate rules.

Instructions

[READ] Flag never-hit enabled rules and shadowed/redundant rules.

Finds enabled rules with zero evaluations (dead or misordered), rules fully covered by an earlier terminating rule (shadowed), and rules identical to an earlier one (redundant). Rules are compared in list order, top-down, exactly as pf evaluates them; every finding names the offending/covering rule uuid. Pass 'rules' for pure analysis, or a target to pull live.

Args: rules: Injected rows {uuid, sequence, enabled, action, interface, protocol, source, destination, destinationPort, evaluations}. interface: Optional interface filter when pulling live. target: Firewall target name from config; omit for the default.

Returns dict: {rulesEvaluated, unusedCount, shadowedCount, redundantCount, unusedRules, shadowedRules, redundantRules, note}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rulesNo
targetNo
interfaceNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.8.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true, and the description adds real substance beyond that: the evaluation model ('compared in list order, top-down, exactly as pf evaluates them') and the fact that every finding names the offending/covering rule uuid. That operational detail is exactly what an agent needs to interpret results, though return-format caveats like the 'note' field are only gestured at.

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?

Front-loads the [READ] marker and one-line summary, then uses labeled Args/Returns blocks. Every sentence is useful; the Returns block is justified because no output schema exists. Slightly verbose in the rules-field enumeration, but not wasteful.

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?

With no output schema, the description documents the return dict keys (rulesEvaluated, unusedCount, shadowedCount, redundantCount, unusedRules, shadowedRules, redundantRules, note). Combined with full parameter coverage and the evaluation semantics, nothing material is missing for correct invocation or interpretation.

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?

Schema description coverage is 0%, so the description must carry the burden, and it does: it documents all three parameters and even enumerates the expected fields of injected 'rules' rows (uuid, sequence, enabled, action, interface, protocol, source, destination, destinationPort, evaluations). It compensates well for the schema gap, with only minor ambiguity about the shape of 'target'.

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?

States a specific verb (flag) and resource (enabled rules), then enumerates the three exact conditions detected: zero evaluations, shadowed by an earlier terminating rule, and redundant/identical duplicates. This distinguishes it clearly from siblings like rule_stats or list_rules, which count or enumerate rather than diagnose misconfiguration.

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?

Explicitly gives the two invocation modes: 'Pass rules for pure analysis, or a target to pull live.' That is clear context for selecting behavior. It stops short of naming alternative sibling tools or stating when-not to use it, so it is a strong 4 rather than a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.