Skip to main content
Glama
FortiManager MCP Server

FortiManager MCP Server

by rstierli

policy_lookup

Simulates a firewall policy lookup for a traffic 5-tuple against a managed device to show which currently installed policy would match the traffic right now.

Instructions

Simulate a firewall policy lookup for a traffic 5-tuple against a managed device.

Proxies FortiGate's policy-lookup monitor API through FortiManager to ask "which policy would match this traffic right now" -- the same operation the FortiManager UI's Policy Lookup dialog performs. This queries the device's currently installed/active policy; it does not take a policy-package argument (the documented endpoint has none -- see module docstring).

Args: adom: ADOM name device: Managed device name (e.g. "FGT-HQ"). Accepts the "device[vdom]" bracket suffix used elsewhere in this codebase to target a specific VDOM. dest: Destination IPv4 address to test (e.g. "8.8.8.8") protocol: IP protocol number to test -- 6=TCP, 17=UDP, 1=ICMP, 47=GRE, 50=ESP, 51=AH, 58=ICMPv6, 132=SCTP. Sent to the device as both the protocol and protocol_number query fields, mirroring the one documented request/response pair in the How-To Guide where both fields carried the same value; the guide does not show a case where they differ. srcintf: Ingress interface name the traffic would arrive on (e.g. "internal"). Optional -- omitted from the query when not given, matching the FortiGate monitor API default. sourceip: Source IPv4 address to test (optional; omitted from the query when not given -- the How-To Guide's own example queried with this field empty) sourceport: Source port to test (optional; omitted when not given) destport: Destination port to test (optional; 0 -- "any port", per the How-To Guide example -- when not given) package: Informational only, NOT sent to the device. The FortiGate policy-lookup endpoint has no package selector; it always reflects whatever package is currently installed. Pass this if you want it echoed back (as package_hint) in the result to cross-check against what you expect to be installed.

Returns: dict: Lookup result with keys: - status: "success" or "error" - adom, device - package_hint: the caller-supplied package argument, echoed back unverified -- NOT confirmation that this package is what actually matched (named package_hint, not package, so it can't be misread as verified match data) - query: the traffic-tuple fields actually sent to the device - matched: bool from the device's results.success field when present, else None (the How-To Guide only documents the no-match case: {"success": false}; a positive match's full field set is not documented here, so it is not reshaped -- see result) - result: the raw results payload returned by the device, passed through unchanged - message: Error message if failed

Example: >>> result = await policy_lookup( ... adom="root", ... device="branch1_fgt", ... srcintf="vl_lan", ... protocol=6, ... dest="8.8.8.8", ... ) >>> result["matched"] False

Input Schema

NameRequiredDescriptionDefault
adomYes
destYes
deviceYes
packageNo
srcintfNo
destportNo
protocolYes
sourceipNo
sourceportNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.12.0

TDQS

A4.3/5.0
Behavior5/5

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

With zero annotations, the description carries the full burden and delivers: it discloses that it proxies a FortiGate monitor API through FortiManager, is a query against the currently installed policy, that `package` is informational and not sent, and that `matched` may be None because only the no-match case is documented. It also flags that positive-match field sets are passed through unreshaped, avoiding overpromising.

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?

Purpose is front-loaded, and Args/Returns/Example structure makes it skimmable. It is somewhat verbose in places — the How-To Guide meta-commentary on protocol/protocol_number and the repeated package_hint caveat could be trimmed without losing information.

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 everything an agent needs for a 9-param, 9-field-output tool: parameter semantics, required vs optional behavior, return-shape caveats, and a worked example. It over-delivers by documenting the return dict even though an output schema exists.

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?

Schema coverage is 0%, so the description must compensate, and it documents all 9 params: protocol with concrete enum values (6=TCP, 17=UDP, etc.), the "device[vdom]" suffix convention, which fields are omitted when unset and the device-default implications, and the subtle package/package_hint distinction. This adds substantial meaning beyond the bare schema.

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?

Opens with a specific verb+resource ("Simulate a firewall policy lookup for a traffic 5-tuple against a managed device") and clarifies the semantics: which policy would match this traffic right now, on the currently installed package. This meaningfully separates it from the many config-oriented policy siblings (get_firewall_policy, list_firewall_policies, search_firewall_policies), though none is named explicitly.

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

Usage Guidelines3/5

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

The use case (test a traffic tuple against the live device, like the UI's Policy Lookup dialog) is clearly conveyed, but there is no explicit when-not or named alternative (e.g., "use X to inspect policy config, use this to test matching"). It says it takes no policy-package argument but doesn't explain what to do instead when a specific package must be tested.

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