Skip to main content
Glama

create_dfw_rule

Create a distributed firewall rule under an existing NSX DFW security policy, specifying action, sources, destinations, and priority.

Instructions

[WRITE] Create a firewall rule under an existing DFW security policy.

Creates via PUT, so calling again with the same rule_id replaces that rule's definition. The rule is enforced on the NSX data plane immediately unless disabled=True. Pick the policy_id with list_dfw_policies first; to change selected fields of an existing rule prefer update_dfw_rule, and to remove one use delete_dfw_rule. Calls are pre-checked by the vmware-policy engine (risk level: medium) and audited to ~/.vmware/audit.db.

Returns the created rule dict from the NSX API (id, path, action, sequence_number, ...). On failure returns {"error", "hint"}; an invalid action/direction/ip_protocol returns an error listing the valid values.

Args: policy_id: Parent policy ID (alphanumeric and hyphens), as returned by list_dfw_policies. rule_id: Unique rule ID within the policy (alphanumeric and hyphens). Reusing an existing ID overwrites that rule. display_name: Human-readable rule name. action: Firewall action — ALLOW, DROP, REJECT, or JUMP_TO_APPLICATION (default: ALLOW). JUMP_TO_APPLICATION is only valid in policies whose category is Environment. sources: Source group policy paths, e.g. ['/infra/domains/default/groups/web']. Use ['ANY'] or omit for any source (default: ANY). destinations: Destination group policy paths, same format as sources. Use ['ANY'] or omit for any destination (default: ANY). services: Service policy paths, e.g. ['/infra/services/HTTPS']. Use ['ANY'] or omit for all services (default: ANY). scope: Applied-to group/segment paths limiting where the rule is enforced. Omit to apply to the entire DFW. direction: Traffic direction — IN, OUT, or IN_OUT (default: IN_OUT). ip_protocol: IP version — IPV4, IPV6, or IPV4_IPV6 (default: IPV4_IPV6). logged: Log matched traffic (default: False). disabled: Create the rule disabled so it is not enforced (default: False). sequence_number: Rule priority within the policy; lower values match first (default: 10). description: Optional free-text description. target: Optional NSX Manager target name from config. Uses the default target if omitted.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
policy_idYes
rule_idYes
display_nameYes
actionNoALLOW
sourcesNo
destinationsNo
servicesNo
scopeNo
directionNoIN_OUT
ip_protocolNoIPV4_IPV6
loggedNo
disabledNo
sequence_numberNo
descriptionNo
targetNo
Behavior1/5

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

The description states that calling again with the same rule_id replaces the rule, which is idempotent behavior, but the annotation sets idempotentHint=false. This contradiction violates the scoring rule, resulting in a score of 1 despite otherwise detailed disclosure of PUT semantics, enforcement, auditing, and error returns.

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 well-structured: a concise one-line summary, followed by behavioral details, usage guidance, and a clearly formatted parameter list. Every sentence adds essential information without redundancy. Despite length, it is appropriately detailed for the tool's complexity.

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?

Covers purpose, behavior (PUT, immediate enforcement, auditing), usage prerequisites, parameter details, return values (dict with fields), error format, and even risk level. For a complex write tool with 15 parameters and no output schema, this description provides complete context for an AI agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, but the description's 'Args:' section thoroughly explains each of the 15 parameters, including format, defaults, valid values (e.g., action: ALLOW, DROP, REJECT, JUMP_TO_APPLICATION), examples (e.g., sources paths), and context (e.g., 'as returned by list_dfw_policies'). This adds significant meaning beyond the schema.

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?

The description explicitly states 'Create a firewall rule under an existing DFW security policy,' identifying the specific verb and resource. It distinguishes from siblings by mentioning 'prefer update_dfw_rule' and 'delete_dfw_rule' for modifications and deletions. The PUT behavior and idempotent overwrite are also clarified.

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?

Provides explicit guidance: 'Pick the policy_id with list_dfw_policies first; to change selected fields of an existing rule prefer update_dfw_rule, and to remove one use delete_dfw_rule.' It also explains when to use disabled=True and notes pre-checks and auditing, giving clear context for using this tool versus alternatives.

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

Install Server

Other Tools

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-Security'

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