Skip to main content
Glama

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
NameRequiredDescriptionDefault
tier1_idYes
targetNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • 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
        ]
  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zw008/VMware-NSX'

If you have feedback or need assistance with the MCP directory API, please join our Discord server