list_nat_rules
Retrieve NAT rules configured on a VMware NSX Tier-1 gateway to manage network address translation policies and verify connectivity settings.
Instructions
List NAT rules on a Tier-1 gateway.
Args: tier1_id: The Tier-1 gateway ID. target: Optional NSX Manager target name from config. Uses default if omitted.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tier1_id | Yes | ||
| target | No |
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- vmware_nsx/ops/networking.py:29-59 (handler)The handler function `list_nat_rules` which performs the API call to NSX to list NAT rules.
def list_nat_rules(client: NsxClient, tier1_id: str) -> list[dict]: """List all user-defined NAT rules on a Tier-1 gateway. Args: client: Authenticated NSX API client. tier1_id: Tier-1 gateway identifier. Returns: List of NAT rule dicts with id, action, networks, and status. """ path = ( f"/policy/api/v1/infra/tier-1s/{tier1_id}" "/nat/USER/nat-rules" ) items = client.get_all(path) return [ { "id": _sanitize(r.get("id", "")), "display_name": _sanitize(r.get("display_name", "")), "action": r.get("action", ""), "source_network": _sanitize(r.get("source_network", "")), "destination_network": _sanitize(r.get("destination_network", "")), "translated_network": _sanitize(r.get("translated_network", "")), "translated_ports": _sanitize(r.get("translated_ports", "")), "enabled": r.get("enabled", True), "logging": r.get("logging", False), "firewall_match": r.get("firewall_match", ""), "sequence_number": r.get("sequence_number", 0), } for r in items ] - mcp_server/server.py:213-224 (registration)The MCP tool registration for `list_nat_rules`, which wraps the networking operations function.
@mcp.tool() def list_nat_rules(tier1_id: str, target: str | None = None) -> list[dict]: """List NAT rules on a Tier-1 gateway. Args: tier1_id: The Tier-1 gateway ID. target: Optional NSX Manager target name from config. Uses default if omitted. """ from vmware_nsx.ops.networking import list_nat_rules as _list_nat client = _get_connection(target) return _list_nat(client, tier1_id)