Skip to main content
Glama

Set network port forwards

set_network_port_forwards
DestructiveIdempotent

Replaces a network's complete NAT port forwarding rule set for TCP or UDP traffic to eligible Firecracker server ports; send an empty rules list to withdraw all rules.

Instructions

Replace the COMPLETE NAT port forwarding rule set of an owned network (rules: [] withdraws all of them) at the router generation read from get_network_port_forwards. Each rule forwards TCP or UDP from the network's NAT public address (external_port) to a server's private port (private_port_id, internal_port). Targets are ports of this network's Firecracker servers that get_network_port_forwards lists as eligible: the first interface of a server without a public IPv4 of its own (kind private_primary) or the private interface of a server that has its own public IPv4 (kind own_ipv4; it answers forwarded connections through the network, and the target's reply_route says whether that reply route is in place or which command the customer runs on the server). Cloud VPS servers are not accepted. Security groups still decide whether the server takes the traffic: this never opens a security group and never buys an address. Mail ports 25, 465, 587 and 2525 are refused for every rule (nat_port_forward_smtp_refused) and a new or changed rule on a port the platform refuses is refused with nat_port_forward_port_refused; a refusal of one rule names it in context.rule_index. At most capability.limit rules (64 at most). A set equal to the applied one answers 200 outcome unchanged; otherwise 202, with outcome queued when an earlier change is still being applied and retried when the identical failed set is sent again. A request that only removes rules is never stopped by a service two-factor or abuse lock. Poll get_network_port_forwards until applied_generation equals generation and state is active or empty; last_change names a change the router refused (the applied rules are unchanged then). Requires explicit networking:read for reads or networking:manage for changes; full/read defaults do not grant networking. The backend enforces ownership, feature availability and service 2FA locks. Read current capabilities and owned resource state first; obtain approval for the exact change. An accepted operation is pending, not proof of connectivity. Poll the returned operation/resource on its in_progress flag, waiting next_check_seconds between reads: while in_progress is true its reason_code is what is awaited (reason_kind waiting, e.g. a queued or pending reason, or a control plane that has not answered yet), never an error; only in_progress false with reason_kind failure is a failure. Preserve reason_code. On transport uncertainty inspect state and reuse only the original key and unchanged request; never automatically retry.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "network_id": "<network_id>",
      "expected_generation": "<expected_generation>",
      "rules": "<rules>",
      "idempotencyKey": "<idempotencyKey>"
    },
    "name": "set_network_port_forwards"
  }
}

Input Schema

NameRequiredDescriptionDefault
rulesYes
network_idYesExact lowercase UUID returned by an owned networking resource
idempotencyKeyYesIdempotency-Key for this exact change; preserve it and the unchanged body on uncertain recovery
expected_generationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.3.21

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the destructive/idempotent annotations: mail ports 25/465/587/2525 are refused with nat_port_forward_smtp_refused, per-rule refusals land in context.rule_index, a 64-rule capability limit applies, an identical set returns 200 unchanged versus 202 queued, requires networking:manage scope (defaults do not grant it), and last_change signals a router-refused change with applied rules unchanged. It also explains reason_kind waiting versus failure so an in-progress operation is not misread as an error.

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 core replacement semantics, generation guard, and refusal rules are front-loaded, so the agent gets the essential contract in the first sentences. The trailing paragraph on pending operations and polling discipline is generic boilerplate that is useful but dilutes focus in an otherwise unbroken wall of text.

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, generation-guarded mutation with no output schema, the description covers everything an agent needs: eligibility of targets, limits, refusal codes, status code meanings, required scopes, and how to poll and recover from transport uncertainty. Nothing critical is delegated to an output schema that does not exist.

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?

Adds real meaning beyond the schema for three of four parameters: expected_generation must be read from get_network_port_forwards, external_port is the network's NAT public address port, and private_port_id must be a port listed as eligible by get_network_port_forwards, with protocol restricted to TCP/UDP. idempotencyKey is addressed only indirectly via 'reuse only the original key and unchanged request,' leaving the schema's own description to carry the rest.

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 precise verb and resource: replace the COMPLETE NAT port forwarding rule set of an owned network, with the scope qualifier that rules: [] withdraws all. It is immediately distinguishable from get_network_port_forwards, which is named as the read/poll counterpart.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly directs the agent to read current capabilities and owned resource state first, to obtain approval for the exact change, and to poll get_network_port_forwards until applied_generation equals generation and state is active or empty. It also states which servers are eligible targets and that Cloud VPS servers are not accepted, and notes that removal-only requests bypass 2FA/abuse locks.

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

Deploy Server

Other Tools