Skip to main content
Glama

Add a firewall rule

mikrotik_firewall_add_rule

Adds a MikroTik firewall rule to a selected chain and table, accepting rule properties and optional placement above an existing rule.

Instructions

Add a firewall rule. properties takes any rule property (src-address, dst-port, protocol, in-interface, connection-state, to-addresses, ...). Use placeBefore with a rule .id to insert it above an existing rule; otherwise it is appended to the end of the table.

Input Schema

NameRequiredDescriptionDefault
ipv6No
chainYes
tableNofilter
actionYese.g. "accept", "drop", "reject", "masquerade", "dst-nat", "add-src-to-address-list"
deviceNoName of the configured device. Defaults to the first device (see mikrotik_list_devices).
commentNo
propertiesNo
placeBeforeNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare this as a non-readonly, non-idempotent, open-world write. The description adds a useful behavioral fact the annotations don't: default append position and the ordering effect of placeBefore. It omits other traits such as the default device selection, and what happens on invalid properties (RouterOS may reject or silently ignore).

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?

Two tight sentences, front-loaded with the purpose, each carrying distinct information about properties and placement. Slight name-restating in the opening clause, but nothing wasteful.

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 an 8-parameter mutation tool with no output schema and a nested free-form object, the description covers the two most subtle parameters but leaves half the surface (chain vs table vs ipv6 interplay, device default, action semantics) to the schema, which itself is thinly described.

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 only 25%, so the description needs to compensate. It does add genuine meaning for `properties` (accepts any RouterOS rule property, with examples) and `placeBefore` (takes a rule .id), but leaves chain, action, table, device, ipv6, and comment undocumented in prose.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Add a firewall rule'), which distinguishes it from the sibling mikrotik_firewall_rules (listing) and from mikrotik_set (modification). It doesn't explicitly name the siblings it differs from, but the operation is unambiguous.

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 gives clear guidance for the placement decision — use placeBefore to insert above an existing rule, otherwise it is appended — which is real when-to-use advice. It offers no guidance on how this relates to generic siblings like mikrotik_add or mikrotik_set, or when to prefer this over editing an existing chain.

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