Skip to main content
Glama

Set port forwarding rule

set_port_forwarding
Destructive

Create or update a port forwarding rule on Keenetic routers using external port and target MAC or registered host IP, with dry-run default to preview changes before applying.

Instructions

Create or update a port forwarding rule ('ip static'). The target is addressed by MAC: pass to_host as a MAC, or as an IP that belongs to a registered host (it is resolved, and refused if unknown). dry_run is TRUE by default - it returns the payload without sending it. A real write is saved to startup-config and verified by re-reading the tree. Protected ports (this server's own and MCP_PROTECTED_PORTS) are refused in code.

Input Schema

NameRequiredDescriptionDefault
portYesExternal port
enableNofalse disables the rule (per-rule flag)
commentNoRule comment
dry_runNoDefault true
to_hostYesTarget MAC, or IP of a registered host
to_portNoInternal port, if different
end_portNoEnd of external port range
protocolNotcp (default) or udp
interfaceNoWAN interface, default GigabitEthernet1

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.9.0

TDQS

A4.4/5.0
Behavior5/5

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

The description substantially adds to the annotations by disclosing dry-run behavior, startup-config persistence, post-write verification, MAC/IP resolution and refusal, and protected-port refusal in code. This is rich behavioral context beyond the destructive/non-idempotent hints.

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 compact and front-loaded, with each sentence carrying concrete operational information. There is no filler or repetition.

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?

For a destructive mutation tool with no output schema, the description covers the essential safety and behavior details: dry run, real-write persistence and verification, target resolution, and protected-port refusals. An agent has enough information to invoke it correctly.

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 coverage is 100%, so the baseline is 3. The description adds important meaning for key parameters: to_host accepts a MAC or registered-host IP with resolution/refusal, dry_run returns the payload without sending, and protected ports are blocked by code.

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?

The description states a specific verb and resource: 'Create or update a port forwarding rule (\'ip static\')'. It is distinguishable from get_port_forwarding and remove_port_forwarding by the create/update framing, but it does not explicitly name or contrast with those sibling tools.

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?

It gives clear operational context: to_host must be a MAC or an IP of a registered host, unknown targets are refused, dry_run defaults to true, and protected ports are refused. It does not explicitly map when to use this tool versus get_port_forwarding or remove_port_forwarding, but the create/update scope is clear.

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