Skip to main content
Glama
FortiManager MCP Server

FortiManager MCP Server

by rstierli

FortiManager MCP Server

CI Python Version License: MIT Version FortiManager

A Model Context Protocol (MCP) server for FortiManager JSON-RPC API. This server enables AI assistants like Claude to interact with FortiManager for centralized firewall policy management, device provisioning, and network configuration.

Note: This is an independent open-source project and is not affiliated with, endorsed by, or supported by Fortinet, Inc. FortiManager is a trademark of Fortinet, Inc.

Disclaimer: This MCP server can create, modify, and delete configurations on FortiManager. Misuse or misconfiguration can impact production networks. Use at your own risk. Always test in a non-production environment first and ensure appropriate ADOM permissions are configured.

Overview

This MCP server provides a comprehensive interface to FortiManager's capabilities, allowing AI assistants to:

  • Create and manage firewall policies and policy packages, including security-profile (UTM) inspection

  • Configure firewall objects (addresses, services, VIPs)

  • Add, provision, and manage FortiGate devices

  • Configure device-DB interfaces, DHCP scopes, and wireless (VAPs, FortiAP/WTP profiles, managed APs)

  • Execute CLI scripts on managed devices

  • Configure provisioning and SD-WAN templates

  • Monitor tasks and installations

  • Manage ADOMs and workspace locking

Related MCP server: FortiGate MCP Server

Features

Category

Capabilities

Policy Management

Create/update/delete firewall policies, per-policy install-on targets, policy packages and policy blocks, clone packages, security-profile (UTM) inspection fields, install preview, package install status and device/package policy comparison

Object Management

Addresses, address groups, services, service groups, search objects

Device Management

Add/delete devices, bulk operations, device status, VDOM management

Device Configuration

Interfaces/VLAN subinterfaces, DHCP scopes, wireless VAPs/SSIDs, FortiAP (WTP) profiles and managed AP registration -- all via the device DB, credential fields stripped from every read

Script Execution

Create/run CLI scripts, execute on devices/groups, view execution logs

Templates

System templates, CLI templates (read, secrets redacted) and template groups, firmware templates, template assignment and validation

SD-WAN

SD-WAN and BGP templates, template assignment, device SD-WAN/BGP/static-route config, live SD-WAN and BGP state, IPsec overlay diagnosis

Device Proxy

Read-only FortiOS REST API access to managed devices through FortiManager

Skills

8 troubleshooting and audit procedures served as MCP prompts (see Skills and Prompts)

System

System status, ADOM management, task monitoring, workspace locking

Requirements

  • Python: 3.12 or higher

  • FortiManager: 7.x or 8.0 with JSON-RPC API access enabled

  • Authentication: API token (recommended) or username/password

  • Network: HTTPS access to FortiManager management interface

Installation

# Clone the repository
git clone https://github.com/rstierli/fortimanager-mcp.git
cd fortimanager-mcp

# Create and activate virtual environment
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
uv sync

Using pip

# Clone the repository
git clone https://github.com/rstierli/fortimanager-mcp.git
cd fortimanager-mcp

# Create virtual environment
python -m venv .venv
source .venv/bin/activate

# Install package
pip install -e .

Using Docker

Pre-built images are available on GitHub Container Registry:

docker pull ghcr.io/rstierli/fortimanager-mcp:latest

Quick start with Docker Compose:

# docker-compose.yml
services:
  fortimanager-mcp:
    image: ghcr.io/rstierli/fortimanager-mcp:latest
    container_name: fortimanager-mcp
    restart: unless-stopped
    ports:
      - "8000:8000"
    env_file:
      - .env
    environment:
      - MCP_SERVER_MODE=http
      - MCP_SERVER_HOST=0.0.0.0
      - MCP_SERVER_PORT=8000
      - FORTIMANAGER_HOST=your-fmg-hostname
      # Keep TLS verification on; import the FortiManager CA for self-signed
      # certs. FORTIMANAGER_VERIFY_SSL=false disables MITM protection.
      - FORTIMANAGER_VERIFY_SSL=true
      - DEFAULT_ADOM=root
      - FMG_TOOL_MODE=full
      - LOG_LEVEL=INFO

Create a .env file for secrets (not tracked in git):

# .env
FORTIMANAGER_API_TOKEN=your-api-token
MCP_AUTH_TOKEN=your-secret-bearer-token  # optional, enables HTTP auth
chmod 600 .env
docker compose up -d

Verify the server is running:

curl http://localhost:8000/health
# {"status": "healthy", "service": "fortimanager-mcp", "fortimanager_connected": true}

Configuration

Environment Variables

Create a .env file from the example:

cp .env.example .env

The .env is located relative to the package source, so it is read when the server runs from a source checkout or an editable install (pip install -e ., the install documented above). A regular pip install . or a wheel does not read it; pass the settings as environment variables instead. The Docker image is unaffected: its Dockerfile installs the package editable, and the Compose example above passes the file through env_file: as environment variables anyway. When no .env was read and the settings fail to load, the startup error names the path that was checked.

Edit .env with your FortiManager settings:

# FortiManager Connection (Required)
FORTIMANAGER_HOST=192.168.1.100

# Authentication Option 1: API Token (Recommended)
FORTIMANAGER_API_TOKEN=your-api-token-here

# Authentication Option 2: Username/Password
# FORTIMANAGER_USERNAME=admin
# FORTIMANAGER_PASSWORD=your-password

# SSL Verification — keep this TRUE. For self-signed FortiManager certs,
# import the FortiManager CA into your trust store instead of disabling it
# (see docs/SETUP_GUIDE.md "Trusting the FortiManager CA"). Setting this to
# false disables TLS verification and exposes the connection to MITM attacks.
FORTIMANAGER_VERIFY_SSL=true

# Request Settings
FORTIMANAGER_TIMEOUT=30
FORTIMANAGER_MAX_RETRIES=2  # retries of a transient error

# Logging
LOG_LEVEL=INFO  # DEBUG for troubleshooting

# Tool Loading Mode (important for context window optimization)
FMG_TOOL_MODE=full  # or "dynamic" for ~90% context reduction

# Default ADOM (optional - defaults to "root")
DEFAULT_ADOM=root

# HTTP Authentication (optional, recommended for Docker/HTTP deployments)
# MCP_AUTH_TOKEN=your-secret-token

# MCP Server Settings (for HTTP/Docker mode)
# MCP_SERVER_MODE=http     # "http" for Docker, "stdio" for Claude Desktop, "auto" to detect
# MCP_SERVER_HOST=0.0.0.0  # Bind address (0.0.0.0 for Docker)
# MCP_SERVER_PORT=8000      # Server port

# Allowed Host headers for HTTP/Docker deployments (optional)
# Set to the value clients use in their connection URL — NOT the client's IP.
# The MCP SDK rejects non-localhost Host headers by default for DNS rebinding protection.
# Examples: ["mcp.example.com"], ["10.1.5.62:8000"], or wildcard ["10.1.5.62:*"]
# MCP_ALLOWED_HOSTS=["mcp.example.com"]

# Streamable HTTP transport mode (optional - stateful by default)
# Set true behind a load balancer / multiple replicas, or a proxy that does not
# preserve the Mcp-Session-Id header, so each request is handled independently.
# MCP_STATELESS_HTTP=true

# HTTP request bounds (optional - bounded by default)
# MCP_MAX_REQUEST_BYTES=10485760     # Max request body; oversize gets 413. 0 disables.
# MCP_MAX_CONCURRENT_REQUESTS=64     # Max in-flight requests; excess gets 503. 0 disables.

# Reversible data masking (optional - off by default, issue #34)
# Masks IOC-bearing VALUES in tool outputs (IPs, subnets, serials, FQDNs,
# admin usernames). Names (object/ADOM/package/VDOM/device) route calls
# and are never masked. Masked values are read-only context: a token sent
# back as a tool argument is refused, so create and modify with real
# values. Requires 32/48/64 hex chars; enabling without a key aborts
# startup. Shares token compatibility with the FortiAnalyzer sibling when
# both use the same key, which also means one shared blast radius.
# MASKING_ENABLED=false
# FMG_MASKING_KEY=

# Safety Guardrails (optional - strict by default)
# FMG_SCRIPT_SAFETY=strict    # Block dangerous CLI commands in scripts (factory-reset, reboot, etc.)
# FMG_POLICY_SAFETY=strict    # Block overly permissive policies (srcaddr=all + dstaddr=all + accept)

Tool Loading Modes

FortiManager MCP supports two tool loading modes to optimize context window usage:

Mode

Tools Loaded

Context Usage

Best For

full (default)

All 253 tools

~100%

Large context windows, full functionality

dynamic

4 discovery tools

~10%

Smaller context windows, on-demand loading

Full Mode (default): All 253 tools are loaded at startup. Best when you have sufficient context window and need immediate access to all FortiManager operations.

Dynamic Mode: Only lightweight discovery tools are loaded:

  • find_fortimanager_tool(operation) - Search for tools by keyword

  • list_fortimanager_categories() - List tool categories

  • execute_fortimanager_tool(name, params) - Execute any tool by name

  • health_check() - Server health status

To enable dynamic mode:

FMG_TOOL_MODE=dynamic

Default ADOM

The DEFAULT_ADOM environment variable sets the default Administrative Domain (ADOM) for all FortiManager operations. When a tool is called without specifying an ADOM, this value is used.

DEFAULT_ADOM=root  # default value

This is particularly useful when:

  • Your FortiManager only uses a single ADOM

  • Most of your work is within one specific ADOM

  • You want to avoid repeatedly specifying the ADOM in each tool call

If not set, defaults to root (the global ADOM).

Default Device

The DEFAULT_DEVICE environment variable sets a fallback managed device for device-scoped tools (e.g. get_device_client_location, get_device_interface_config, get_device_sdwan_monitor). When such a tool is called without a device, this value is used.

DEFAULT_DEVICE=myfw01   # unset by default

It is unset by default because there is no universal device name. Setting it is recommended for single-FortiGate deployments (and when driving the tools from an LLM, which may omit device if it treats it as an implied default) — the tool then resolves to DEFAULT_DEVICE instead of erroring. If neither a device argument nor DEFAULT_DEVICE is provided, the tool returns a clear device_required error.

Generating an API Token

  1. Log into FortiManager web interface

  2. Go to System Settings > Admin > Administrators

  3. Edit your admin user or create a new one

  4. Under JSON API Access, click Regenerate or New API Key

  5. Copy the generated token

Running the Server

Standalone Mode

# Using the installed command
fortimanager-mcp

# Or using Python module
python -m fortimanager_mcp

Claude Desktop Integration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "fortimanager": {
      "command": "/path/to/fortimanager-mcp/.venv/bin/fortimanager-mcp",
      "env": {
        "FORTIMANAGER_HOST": "your-fmg-hostname",
        "FORTIMANAGER_API_TOKEN": "your-api-token",
        "FORTIMANAGER_VERIFY_SSL": "true",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Note: Use the full path to the fortimanager-mcp executable in your virtual environment.

Claude Code Integration

Add to ~/.claude/mcp_servers.json:

{
  "mcpServers": {
    "fortimanager": {
      "command": "/path/to/fortimanager-mcp/.venv/bin/fortimanager-mcp",
      "env": {
        "FORTIMANAGER_HOST": "your-fmg-hostname",
        "FORTIMANAGER_API_TOKEN": "your-api-token",
        "FORTIMANAGER_VERIFY_SSL": "true",
        "DEFAULT_ADOM": "root",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Docker Mode

# Start the server
docker compose up -d

# View logs
docker compose logs -f

# Stop the server
docker compose down

HTTP Mode (Remote Access)

When running in HTTP mode (Docker or standalone with MCP_SERVER_MODE=http), MCP clients connect via the Streamable HTTP transport:

Claude Code (~/.claude/mcp_servers.json):

{
  "mcpServers": {
    "fortimanager": {
      "type": "streamable-http",
      "url": "https://your-mcp-host.example.com/mcp",
      "headers": {
        "Authorization": "Bearer your-mcp-auth-token"
      }
    }
  }
}

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "fortimanager": {
      "type": "streamable-http",
      "url": "https://your-mcp-host.example.com/mcp",
      "headers": {
        "Authorization": "Bearer your-mcp-auth-token"
      }
    }
  }
}

Production Deployment (Reverse Proxy)

For production deployments behind a TLS-terminating reverse proxy:

MCP Client → HTTPS → Reverse Proxy (Traefik/nginx) → HTTP → MCP Container → FortiManager

Key considerations:

  1. MCP_ALLOWED_HOSTS — The MCP SDK validates the Host header to prevent DNS rebinding attacks. By default only localhost and 127.0.0.1 are accepted. Set this to the value clients put in their connection URL (NOT the client's IP):

    # Reverse-proxy hostname (Traefik/nginx):
    MCP_ALLOWED_HOSTS=["mcp.example.com"]
    # Direct Docker exposure on IP+port:
    MCP_ALLOWED_HOSTS=["10.1.5.62:8000"]
    # Port wildcard (any port on the host):
    MCP_ALLOWED_HOSTS=["10.1.5.62:*"]
  2. MCP_AUTH_TOKEN — Always set a Bearer token for HTTP deployments:

    MCP_AUTH_TOKEN=$(openssl rand -hex 32)
  3. Secrets management — Keep API tokens and auth tokens in an env_file (.env), not inline in docker-compose.yml.

  4. MCP_STATELESS_HTTP — When the server runs behind a load balancer or as multiple replicas (or behind a proxy that does not preserve the Mcp-Session-Id header), enable stateless mode so each request is self-contained and no sticky sessions are required:

    MCP_STATELESS_HTTP=true

    Leave it unset (stateful, the default) for single-instance deployments. Stateless mode disables server-initiated streaming that relies on a persistent session.

Example with Traefik:

services:
  fortimanager-mcp:
    image: ghcr.io/rstierli/fortimanager-mcp:latest
    container_name: fortimanager-mcp
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    env_file:
      - .env
    environment:
      - MCP_SERVER_MODE=http
      - MCP_SERVER_HOST=0.0.0.0
      - MCP_SERVER_PORT=8000
      - FORTIMANAGER_HOST=your-fmg-hostname
      # Keep TLS verification on; import the FortiManager CA for self-signed
      # certs. FORTIMANAGER_VERIFY_SSL=false disables MITM protection.
      - FORTIMANAGER_VERIFY_SSL=true
      - MCP_ALLOWED_HOSTS=["mcp.example.com"]
      - DEFAULT_ADOM=root
      - FMG_TOOL_MODE=full
      - LOG_LEVEL=INFO
    networks:
      - frontend
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.fmg-mcp-secure.entrypoints=https"
      - "traefik.http.routers.fmg-mcp-secure.rule=Host(`mcp.example.com`)"
      - "traefik.http.routers.fmg-mcp-secure.tls=true"
      - "traefik.http.services.fmg-mcp.loadbalancer.server.port=8000"
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

networks:
  frontend:
    external: true

Available Tools (253 tools)

System Tools (17 tools)

Tool

Description

get_system_status

Get FortiManager system status and version info

get_ha_status

Get High Availability cluster status

list_adoms

List all Administrative Domains

get_adom

Get specific ADOM details

list_devices

List devices in an ADOM

get_device

Get specific device information

list_device_groups

List device groups in an ADOM

list_tasks

List background tasks

get_task

Get task details by ID

wait_for_task

Wait for a task to complete

list_packages

List policy packages in an ADOM

get_package

Get policy package details

install_package

Install policy package to devices

install_device_settings

Install device settings only, with an optional revision comment (dev_rev_comments); needs a preview_install with package=None first (FMG_INSTALL_SAFETY)

lock_adom

Lock ADOM for editing (workspace mode)

unlock_adom

Unlock ADOM

commit_adom

Commit ADOM changes

Device Management Tools (17 tools)

Tool

Description

list_device_vdoms

List VDOMs for a device

get_device_status

Get device connection and sync status

search_devices

Search devices with filters

add_device

Add a new device to FortiManager

add_model_device

Add offline model device; optional device_blueprint (saved blueprint name or inline blueprint object; every referenced object is checked to exist first), per-device meta_variables, groups, patch level via os_version="7.4.12", and model HA clusters via ha_mode/ha_group_name/ha_members. Refused if the name or serial is already in use; a blueprint that enforces a firmware version needs confirm=True (FMG_FIRMWARE_SAFETY)

list_metadata_variables

List an ADOM's metadata variables with their per-device values (password-type values redacted)

check_device_variables

Check a device's metadata variables against expected values (match / mismatch / not mapped / undefined)

set_metadata_variable

Set a device's value for an existing metadata variable, in every scope the device has unless vdom is given

delete_device

Remove a device from FortiManager

add_devices_bulk

Add multiple devices at once

delete_devices_bulk

Remove multiple devices at once

update_device

Update device metadata

reload_device_list

Refresh device list cache

get_device_realtime_status

Get live device status

get_device_interfaces

Get device interface information

get_device_interface_config

Read device-DB interface config objects, filterable by VLAN id / interface name (maps a client IP to its VLAN/interface/port)

get_device_client_location

Asset Identity Center: locate a client (by ip/mac/hostname) via the live detected-device inventory — resolves the FortiAP/FortiSwitch, port and VLAN it is connected through

Device Configuration Tools (21 tools)

Typed device-DB configuration (issues #45, #52): everything is staged in FortiManager's device database and pushed with preview_install + install_device_settings; nothing talks to the FortiGate directly.

Tool

Description

create_device_interface

Create a VLAN subinterface (parent, vlanid, ip, allowaccess, role, alias)

update_device_interface

Update device-DB interface fields

delete_device_interface

Delete a device-DB interface

list_device_dhcp_servers

List DHCP server scopes in the device DB

create_device_dhcp_server

Create a DHCP scope (interface, range, netmask, gateway, DNS)

update_device_dhcp_server

Update a DHCP scope by id

delete_device_dhcp_server

Delete a DHCP scope by id

list_device_vaps

List wireless VAPs (SSIDs), passphrases stripped

create_device_vap

Create a wireless VAP/SSID with security mode and VLAN mapping

delete_device_vap

Delete a wireless VAP

assign_vap_to_wtp_profile

Add a VAP to FortiAP profile radios so the SSID broadcasts

list_device_wtp_profiles

List FortiAP (WTP) profiles in the device DB

get_device_wtp_profile

Get a FortiAP (WTP) profile, radios included

update_device_wtp_profile_radio

Update one radio's channel/channel-bonding, other fields untouched

list_device_wtps

List managed FortiAPs (wireless-controller wtp) in the device DB

get_device_wtp

Get a managed FortiAP by wtp-id (serial number)

create_device_wtp

Register a managed FortiAP (wtp-id, wtp-profile, authorization state)

update_device_wtp

Update a managed FortiAP's profile/name/admin/location/comment

delete_device_wtp

Delete a managed FortiAP registration

create_device_sniffer

Create a firewall sniffer definition (firewall sniffer) on the device itself, not FortiManager's own local sniffer

create_device_on_demand_sniffer

Create a bounded, name-keyed on-demand packet sniffer (firewall on-demand-sniffer), distinct from the persistent firewall sniffer object

Policy Tools (27 tools)

create_firewall_policy and update_firewall_policy accept security-profile (UTM) fields -- utm_status, av_profile, ips_sensor, webfilter_profile, dnsfilter_profile, application_list, file_filter_profile, ssl_ssh_profile, profile_protocol_options, profile_group -- so a policy can actually apply inspection, not just route traffic. profile_group is mutually exclusive with the individual profile fields it bundles; see "Security Profile Field Validation" under Safety Guardrails below.

They also take install_on: the devices ({"name": "branch1", "vdom": "root"}) and device groups ({"name": "emea_spokes"}) a policy installs on, stored by FortiManager as the policy's scope member. Left out, the policy installs on every device the package goes to; on update, [] clears the targets. list_firewall_policies and get_firewall_policy return each policy's scope member.

clone_package changed in 1.13.0: the clone is not assigned to any device unless copy_installation_targets=True, and each policy's install-on targets are copied from the source either way. It now sends the new name as dst_name, the parameter FNDN documents for package/clone.

Tool

Description

list_policy_blocks

List the policy blocks of an ADOM

list_policy_block_policies

List the firewall policies held in a policy block

create_package

Create a new policy package

delete_package

Delete a policy package

clone_package

Clone an existing package, unassigned by default (copy_installation_targets=True keeps the source's assignment); waits for the clone task

assign_package

Assign package to devices

list_firewall_policies

List policies in a package, with their install-on targets

get_firewall_policy

Get policy details, with its install-on targets

create_firewall_policy

Create a new firewall policy (optional install_on targets)

update_firewall_policy

Update an existing policy (optional install_on targets)

delete_firewall_policy

Delete a firewall policy

delete_firewall_policies_bulk

Bulk delete policies

move_firewall_policy

Reorder policy position

search_firewall_policies

Search policies with filters

get_policy_services

Get policy services with optional group resolution

preview_install

Preview the CLI an install would push (package, or device settings with package=None)

get_preview_result

Re-fetch an install preview result

create_local_in_policy

Create a new IPv4 local-in policy

create_local_in_policy6

Create a new IPv6 local-in policy

delete_local_in_policy

Delete an IPv4 local-in policy

delete_local_in_policy6

Delete an IPv6 local-in policy

get_local_in_policy

Get detailed information about a specific IPv4 local-in policy

get_local_in_policy6

Get detailed information about a specific IPv6 local-in policy

list_local_in_policies

List IPv4 local-in policies in a policy package

list_local_in_policies6

List IPv6 local-in policies in a policy package

update_local_in_policy

Update an existing IPv4 local-in policy

update_local_in_policy6

Update an existing IPv6 local-in policy

Policy Sync Tools (2 tools)

Tool

Description

get_package_install_status

Per-device package assignment and install status (installed / modified / out of sync)

check_device_policy_sync

Compare a device's firewall policies (latest revision and/or device DB) with its assigned package

Object Tools (25 tools)

Tool

Description

list_addresses

List firewall address objects

get_address

Get address object details

create_address_subnet

Create subnet address

create_address_host

Create host address

create_address_fqdn

Create FQDN address

create_address_range

Create IP range address

update_address

Update address object

delete_address

Delete address object

list_address_groups

List address groups

get_address_group

Get address group details

create_address_group

Create address group

update_address_group

Update address group

delete_address_group

Delete address group

list_services

List service objects

get_service

Get service details

create_service_tcp_udp

Create TCP/UDP service

create_service_icmp

Create ICMP service

update_service

Update service object

delete_service

Delete service object

list_service_groups

List service groups

get_service_group

Get service group details

create_service_group

Create service group

update_service_group

Update service group members and comment

delete_service_group

Delete service group

search_objects

Search all object types

Script Tools (12 tools)

Tool

Description

list_scripts

List CLI scripts in ADOM

get_script

Get script content and details

create_script

Create a new CLI script

update_script

Update existing script

delete_script

Delete a script

execute_script_on_device

Run script on single device

execute_script_on_devices

Run script on multiple devices

execute_script_on_device_group

Run script on device group

execute_script_on_package

Run script on package/ADOM DB

get_script_log_latest

Get latest execution log

get_script_log_summary

Get execution history

get_script_log_output

Get specific log output

Template Tools (17 tools)

Tool

Description

list_templates

List provisioning templates

get_template

Get template details

list_system_templates

List system templates (devprof)

get_system_template

Get system template details

assign_system_template

Assign template to device

assign_system_template_bulk

Bulk assign system template

unassign_system_template

Remove template assignment

list_cli_templates

List CLI templates without their scripts

get_cli_template

Read a CLI template and its script (CLI or Jinja), secrets redacted: set <secret> values, ENC blobs, secret-named Jinja {% set %} assignments and secret-keyed literals; a bare {{ var }} / $(var) reference stays visible

list_cli_template_groups

List CLI template groups

get_cli_template_group

Get CLI template group

create_cli_template_group

Create CLI template group

delete_cli_template_group

Delete CLI template group

list_template_groups

List template groups

get_template_group

Get template group

assign_template_group

Assign template group

validate_template

Validate template against device

SD-WAN Tools (17 tools)

Tool

Description

list_sdwan_templates

List SD-WAN templates

get_sdwan_template

Get SD-WAN template details

create_sdwan_template

Create SD-WAN template

delete_sdwan_template

Delete SD-WAN template

assign_sdwan_template

Assign template to device

assign_sdwan_template_bulk

Bulk assign SD-WAN template

unassign_sdwan_template

Remove template assignment

get_device_sdwan

Read a device's SD-WAN config (members/zones/health-checks/rules) from the device DB — for SD-WAN configured locally, not via a template

get_device_sdwan_monitor

Live SD-WAN Monitor via the device proxy — per-member link/bandwidth (virtual-wan/members) + per-member SLA health (virtual-wan/health-check)

get_device_bgp_status

Live BGP state via the device proxy — peer state (router/bgp/neighbors), learned paths (router/bgp/paths) and BGP routes in the routing table (router/ipv4)

diagnose_ipsec_tunnel

Diagnose a down overlay tunnel, underlay first: underlay admin status, live link and address, live IKE/phase2 state, SD-WAN member and health-check state and, with hub_device, the hub's matching dial-up gateway (by network-id). Returns a verdict (underlay_link_down, tunnel_down, health_check_down, ...) with next steps

get_sdwan_template_config

Read the body of an SD-WAN (wanprof) template — members, zones, health-checks with SLA thresholds, steering rules. get_sdwan_template returns only the template metadata

get_bgp_template

Read the router bgp body of a BGP provisioning template (AS, router-id, neighbors, neighbor-groups/ranges, networks); neighbor passwords stripped

update_bgp_template

Change neighbor-group options in a BGP template: route-reflector-client, next-hop-self, next-hop-self-rr, soft-reconfiguration, advertisement-interval

get_device_bgp

Read a device's router bgp config from the device DB; neighbor passwords stripped

get_device_static_routes

Read a device's IPv4 static routes from the device DB

resolve_datasource

Generic config-DB introspection: resolve the objects a config attribute is allowed to reference (option: datasrc)

Security Profile Tools (21 tools)

Tool

Description

get_profile_group

Read a firewall security profile group

create_antivirus_profile

Create an antivirus profile

create_application_list

Create an application-control list

create_dnsfilter_profile

Create a DNS filter profile

create_webfilter_profile

Create a web filter profile

delete_antivirus_profile

Delete an antivirus profile

delete_application_list

Delete an application-control list

delete_dnsfilter_profile

Delete a DNS filter profile

delete_webfilter_profile

Delete a web filter profile

get_antivirus_profile

Get detailed information about an antivirus profile

get_application_list

Get detailed information about an application-control list

get_dnsfilter_profile

Get detailed information about a DNS filter profile

get_webfilter_profile

Get detailed information about a web filter profile

list_antivirus_profiles

List antivirus profiles in an ADOM

list_application_lists

List application-control lists in an ADOM

list_dnsfilter_profiles

List DNS filter profiles in an ADOM

list_webfilter_profiles

List web filter profiles in an ADOM

update_antivirus_profile

Update an existing antivirus profile

update_application_list

Update an existing application-control list

update_dnsfilter_profile

Update an existing DNS filter profile

update_webfilter_profile

Update an existing web filter profile

Security Profile (Advanced) Tools (23 tools)

Tool

Description

add_ips_sensor_signature_override

Add a signature filter/override entry to an IPS sensor

create_dlp_profile

Create a DLP (Data Loss Prevention) profile

create_ips_sensor

Create an IPS sensor

create_ssl_ssh_profile

Create an SSL/SSH inspection profile

create_waf_profile

Create a WAF (Web Application Firewall) profile

delete_dlp_profile

Delete a DLP profile

delete_ips_sensor

Delete an IPS sensor

delete_ssl_ssh_profile

Delete an SSL/SSH inspection profile

delete_waf_profile

Delete a WAF profile

get_dlp_profile

Get detailed information about a DLP profile

get_ips_sensor

Get detailed information about an IPS sensor

get_ssl_ssh_profile

Get detailed information about an SSL/SSH inspection profile

get_waf_profile

Get detailed information about a WAF profile

list_dlp_profiles

List DLP (Data Loss Prevention) profiles in an ADOM

list_ips_sensor_signature_overrides

List the signature-filter/override entries of an IPS sensor

list_ips_sensors

List IPS sensors in an ADOM

list_ssl_ssh_profiles

List SSL/SSH inspection profiles in an ADOM

list_waf_profiles

List WAF (Web Application Firewall) profiles in an ADOM

remove_ips_sensor_signature_override

Remove a signature filter/override entry from an IPS sensor

update_dlp_profile

Update a DLP profile's top-level settings

update_ips_sensor

Update an IPS sensor's top-level settings

update_ssl_ssh_profile

Update an SSL/SSH inspection profile

update_waf_profile

Update a WAF profile's top-level settings

VPN Tools (14 tools)

Tool

Description

create_device_ipsec_phase1_interface

Create an IPsec phase1-interface (remote gateway / IKE SA) in a device's device DB

create_device_ipsec_phase2_interface

Create an IPsec phase2-interface (tunnel/traffic selector) in a device's device DB

delete_device_ipsec_phase1_interface

Delete an IPsec phase1-interface from a device's device DB

delete_device_ipsec_phase2_interface

Delete an IPsec phase2-interface from a device's device DB

get_device_ipsec_phase1_interface

Get one IPsec phase1-interface (remote gateway) from a device's device DB

get_device_ipsec_phase2_interface

Get one IPsec phase2-interface (tunnel/selector) from a device's device DB

get_device_sslvpn_settings

Get the SSL-VPN (Agentless VPN) settings object from a device's device DB

get_device_sslvpn_web_portal

Get an SSL-VPN web portal from a device's device DB

list_device_ipsec_phase1_interfaces

List IPsec phase1-interface (remote gateway) definitions in a device's device DB

list_device_ipsec_phase2_interfaces

List IPsec phase2-interface (tunnel/selector) definitions in a device's device DB

update_device_ipsec_phase1_interface

Update fields on a device-DB IPsec phase1-interface, unspecified fields unchanged

update_device_ipsec_phase2_interface

Update fields on a device-DB IPsec phase2-interface, unspecified fields unchanged

update_device_sslvpn_settings

Update the SSL-VPN (Agentless VPN) settings object in a device's device DB

update_device_sslvpn_web_portal

Update an SSL-VPN web portal in a device's device DB

Revision History Tools (11 tools)

Tool

Description

diff_adom_revision

Diff a past ADOM DB revision against the CURRENT live ADOM

diff_device_revision

Diff a past device DB revision against the CURRENT device DB; sections=["router bgp", ...] limits it to those config blocks. Header and blank-line noise is dropped, secrets redacted on both sides

diff_policy_package

Diff a policy package's objects at a past ADOM revision against its CURRENT live state

get_adom_revision

Get one ADOM DB revision's metadata

get_device_revision

Check out one device DB revision's stored configuration text

list_adom_revisions

List the ADOM DB revision history for an ADOM

list_device_revisions

List the device DB revision history for a managed device

list_policy_revisions

List the change log for a policy package's firewall policies

revert_adom_revision

Revert the live ADOM DB to a past revision

revert_device_revision

Revert a device's device DB to a past revision

revert_firewall_policy

Restore a firewall policy to a past change-log snapshot

FortiManager Operations Tools (9 tools)

Tool

Description

add_packet_capture

Add a new FortiManager packet capture definition

delete_task

Delete a task record from FortiManager's task list

get_fmg_license

Get the FortiManager license/contract status

get_packet_capture_status

Get the running/packet-count status of packet captures

list_packet_captures

List existing FortiManager packet capture definitions

start_packet_capture

Start a packet capture from an existing definition

stop_packet_capture

Stop a running packet capture

trigger_fmg_backup

Trigger a FortiManager system backup to a remote server

trigger_fmg_restore

Restore the FortiManager system from a backup on a remote server

Device Group Tools (8 tools)

Tool

Description

add_device_to_group

Add a single device to a device group

add_devices_to_group_bulk

Add multiple devices to a device group in one call

add_group_to_group

Nest a device group inside another device group

create_device_group

Create a device group in FortiManager's device manager database

delete_device_group

Delete a device group from FortiManager

remove_device_from_group

Remove a single device from a device group

remove_devices_from_group_bulk

Remove multiple devices from a device group in one call

remove_group_from_group

Remove a nested group from its parent device group

Firmware Tools (8 tools)

Tool

Description

create_firmware_template

Create a firmware template enforcing a version per platform (checked against the firmware catalog, created unassigned)

delete_firmware_template

Delete a firmware template (refused while it is assigned)

list_firmware_templates

List firmware templates with enforced versions, schedule and assignment

get_firmware_upgrade_path

Preview the multi-step firmware upgrade path to a target version

get_firmware_upgrade_report

Get the firmware upgrade report for a device under a named profile

list_available_firmware

List firmware versions available for a platform

list_firmware_images

List firmware image files stored on the FortiManager's local disk

upgrade_device_firmware

Trigger a firmware upgrade on a managed device

Object Usage Tools (2 tools)

Tool

Description

find_duplicate_objects

Find objects with identical content configured under different names

find_object_usage

Find everywhere an ADOM object is referenced (where-used)

Policy Lookup Tools (1 tool)

Tool

Description

policy_lookup

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

Device Proxy Tools (1 tool)

Tool

Description

query_device_api

Read an allowlisted FortiOS monitor or cmdb diagnostic path on a managed device through /sys/proxy/json. GET only, secrets redacted, other paths and file exports refused

Skills and Prompts

The server ships eight troubleshooting and audit playbooks ("skills"): step-by-step procedures for recurring FortiManager tasks (install failures, SD-WAN overlays, policy audits, ...) that say which tools to call, in which order, and what to look for. Each one is a SKILL.md in the Claude skill format under src/fortimanager_mcp/skills/, and the server also serves each one as an MCP prompt, so any MCP client can use them.

A prompt is picked by the user, not by the model: the client lists the server's prompts, you choose one, and its text (the playbook, with what you filled in as the argument appended as a fenced data block, up to 2 KB per argument) goes into the conversation. Nothing is sent until you ask for a prompt, so the skills add no context to a session that does not use them. Prompts load in both FMG_TOOL_MODE=full and dynamic; in dynamic mode they tell the model to call tools through execute_fortimanager_tool.

The playbooks only read and propose changes: any change, install or device command waits for your approval. Running an install preview does create FortiManager tasks, and a successful preview allows one install of the same package (or device settings, with package=None) and devices (see FMG_INSTALL_SAFETY).

Prompt

Argument

Skill

Use it for

troubleshoot_sdwan_overlay

symptom

fmg-sdwan-overlay-troubleshoot

Tunnels up but no traffic, BGP not coming up, failures after re-running the SD-WAN Overlay Template

audit_firewall_policy

target

fmg-firewall-policy-audit

Audit a package, or explain why one flow is allowed or blocked

diagnose_install_status

target

fmg-install-status-diagnosis

conflict, out of sync or modified statuses, and whether installing is safe

diagnose_install_failure

symptom

fmg-install-failure-diagnosis

An install or preview that failed

check_template_rerun

context

fmg-template-rerun-check

What a re-run or edited Overlay Template changes

check_device_health

device

fmg-device-health

A FortiGate that looks down or unmanaged, or a general health review

locate_host

host

fmg-host-location

Find a host's FortiSwitch port, VLAN or FortiAP from its IP, MAC or hostname

trace_flow

source, destination

fmg-faz-flow-trace

Trace a flow between two IPs: devices, rules, tunnels and logs. Uses the FortiAnalyzer MCP server when it is connected

Every argument is optional free text; leave it empty and the model asks. trace_flow works best with the fortianalyzer MCP server connected too; its HTML report template is served as the MCP resource fortimanager://skills/fmg-faz-flow-trace/references/report-template.html.

Using a prompt from a client

  • Claude Code: prompts show up as slash commands named /mcp__<server>__<prompt>, where <server> is the name you gave the server in your MCP config. With the server registered as fortimanager: /mcp__fortimanager__diagnose_install_failure install of branch1 failed.

  • Claude Desktop: open the attach (+) menu in the message box, pick the FortiManager server and then the prompt, and fill in the argument.

  • Any other MCP client: the prompts come from the standard prompts/list and prompts/get requests; see your client's documentation for where it shows them.

Using the skills directly in Claude Code

Claude Code can also load the same SKILL.md files as skills, which it then applies by itself when a request matches the skill's description (no slash command needed). Link the skill folders into your skills directory, for example from a clone of this repository:

ln -s "$PWD"/src/fortimanager_mcp/skills/* ~/.claude/skills/

Not the same as faz_skill

The FortiAnalyzer MCP server exposes its procedures through a tool, faz_skill, which the model calls by itself to fetch a procedure mid-task. This server has no such tool: its skills are prompts that you pick, so they never appear in the tool list and do not count toward the 253 tools. When both servers are connected, trace_flow uses FortiAnalyzer's tools for the log half of the trace; it does not call faz_skill.

Usage Examples

Policy Management

"List all firewall policies in the 'default' package"
"Create a new policy to allow HTTP traffic from internal to wan1"
"Move policy 10 before policy 5 in the default package"
"Install the branch-policy package to FGT-01"

Object Management

"Create an address object for the web server at 192.168.10.10"
"List all address groups in the root ADOM"
"Create a service for TCP port 8443"
"Search for all objects containing 'web' in the name"

Device Management

"List all devices in the root ADOM"
"Add a new FortiGate device at 10.0.0.1"
"Get the connection status for FGT-01"
"Show the VDOMs configured on FGT-01"

Script Execution

"List all CLI scripts in the root ADOM"
"Create a backup script that runs 'execute backup config ftp'"
"Execute the backup script on FGT-01"
"Show the latest script execution log for FGT-01"

Template Management

"List all system templates in the ADOM"
"Assign the 'Branch-Template' to FGT-01"
"Show available SD-WAN templates"
"Validate the template against device FGT-01"

System Operations

"What is the FortiManager system status?"
"Lock the root ADOM for editing"
"Show all running tasks"
"Wait for task 123 to complete"

Architecture

fortimanager-mcp/
├── src/fortimanager_mcp/
│   ├── api/
│   │   └── client.py          # FortiManager API client (JSON-RPC)
│   ├── tools/
│   │   ├── system_tools.py    # System, ADOM, task management
│   │   ├── dvm_tools.py       # Device management tools
│   │   ├── policy_tools.py    # Policy and package tools
│   │   ├── object_tools.py    # Address, service objects
│   │   ├── script_tools.py    # CLI script tools
│   │   ├── template_tools.py  # Provisioning templates
│   │   └── sdwan_tools.py     # SD-WAN templates
│   ├── utils/
│   │   ├── config.py          # Configuration management
│   │   └── errors.py          # Error handling
│   └── server.py              # MCP server implementation
├── tests/                     # Test suite (190+ tests)
├── docs/                      # API documentation
├── .env.example               # Example configuration
├── pyproject.toml             # Project configuration
├── Dockerfile                 # Container image definition
└── docker-compose.yml         # Container orchestration

API Reference

The server communicates with FortiManager using the JSON-RPC API over HTTPS. All requests are sent to the /jsonrpc endpoint.

Supported FortiManager Versions

Version

Status

8.0.x

Supported. Every release is tested live against 8.0.2 (primary development target). 8.0.0 and 8.0.1 are untested; they use the task-based install preview, since the staged preview needs 8.0.2.

7.6.x

Supported. Tested live against 7.6.7 up to 1.12.0. Before 7.6.7, the install preview is task-based.

7.4.x, 7.2.x

Expected to work. Built against the FNDN API reference for 7.4.8 and 7.2.11, not tested live.

7.0.x

Expected to work, not tested.

Details and version-specific differences: docs/test-results/compatibility.md.

Authentication Methods

  1. API Token (Recommended)

    • More secure, no session management

    • Tokens can be revoked without changing passwords

    • Works with FortiManager 7.0+

  2. Username/Password

    • Traditional session-based authentication

    • Session automatically managed by the client

Troubleshooting

Enable Debug Logging

Set LOG_LEVEL=DEBUG in your environment to see detailed API requests and responses:

LOG_LEVEL=DEBUG fortimanager-mcp

Common Issues

Connection Failed

  • Verify FortiManager hostname/IP is correct

  • Check network connectivity and firewall rules

  • Ensure HTTPS port (443) is accessible

Authentication Failed

  • Verify API token or credentials are correct

  • Check if the admin account has API access enabled

  • Ensure the account has sufficient permissions

SSL Certificate Errors

  • For self-signed FortiManager certs, import the FortiManager CA certificate into your trust store and keep FORTIMANAGER_VERIFY_SSL=true (see SETUP_GUIDE.md → "Trusting the FortiManager CA")

  • For production, use valid SSL certificates signed by a trusted CA

  • Last resort only: FORTIMANAGER_VERIFY_SSL=false disables TLS verification and exposes the connection to man-in-the-middle attacks — avoid in production

ADOM Locked

  • Another user may have the ADOM locked

  • Use unlock_adom to release the lock (requires permissions)

  • Check workspace mode settings in FortiManager

MCP Transport Issues

Invalid Host header (HTTP/Docker mode)

Symptom — server logs show:

mcp.server.transport_security - WARNING - Invalid Host header: 10.x.y.z:8000
INFO:     ... "POST /mcp HTTP/1.1" 421 Misdirected Request

Cause: the MCP SDK validates the Host header for DNS rebinding protection. By default only localhost and 127.0.0.1 are accepted. The header value is whatever the client puts in its connection URL — not the client's IP.

Fix: add the URL value (with port, if used) to MCP_ALLOWED_HOSTS:

# If the client connects to http://10.1.5.62:8000/mcp:
MCP_ALLOWED_HOSTS=["10.1.5.62:8000"]
# Or use a port wildcard to allow any port on that host:
MCP_ALLOWED_HOSTS=["10.1.5.62:*"]
# For a reverse-proxy hostname:
MCP_ALLOWED_HOSTS=["mcp.example.com"]

PermissionError: pyvenv.cfg (macOS stdio mode)

Symptom — Claude Desktop MCP logs show:

Fatal Python error: init_import_site: Failed to import the site module
PermissionError: [Errno 1] Operation not permitted: '.../.venv/pyvenv.cfg'

Cause: macOS TCC (Transparency, Consent, Control) blocks Claude Desktop from launching executables from inside ~/Documents, ~/Desktop, or ~/Downloads.

Fix (preferred): move the project out of those folders, recreate the venv, and update Claude Desktop's MCP config to the new path:

mv ~/Documents/mcp ~/mcp
cd ~/mcp/fortimanager-mcp
rm -rf .venv && uv sync
# Then update the "command" path in claude_desktop_config.json

Fix (alternative): grant Claude Desktop Full Disk Access — System Settings → Privacy & Security → Full Disk Access → add Claude. Broader permission; only use if relocation isn't feasible.

Viewing Logs

Claude Desktop MCP Server Logs:

  • macOS: ~/Library/Logs/Claude/mcp-server-fortimanager.log

  • Windows: %APPDATA%\Claude\logs\mcp-server-fortimanager.log

Development

Running Tests

The project includes 190+ tests covering all tool modules, error handling, and validation logic.

# Install dev dependencies
uv sync --all-extras

# Run all unit tests
pytest

# Run with coverage report
pytest --cov=src/fortimanager_mcp --cov-report=html

# Run specific test file
pytest tests/test_policy_tools.py -v

# Run tests with verbose output
pytest -v

Integration Tests

Integration tests require a real FortiManager instance and are not run in CI.

# Set up environment
export FORTIMANAGER_HOST=your-fmg-host
export FORTIMANAGER_API_TOKEN=your-token
# Keep verification on; import the FortiManager CA for self-signed certs.
export FORTIMANAGER_VERIFY_SSL=true

# Run integration tests (requires live FMG)
pytest tests/integration/ -v

Note: Integration tests are verified against FortiManager 7.6.2. Some features may behave differently on older versions.

CI Workflow

The project uses GitHub Actions for continuous integration:

  • Linting: ruff check on all source files

  • Type checking: mypy with strict mode

  • Unit tests: pytest with coverage reporting

  • Python versions: 3.12+

All CI checks must pass before merging pull requests.

Code Quality

# Linting
ruff check src/

# Type checking
mypy src/

# Formatting
ruff format src/

Security Considerations

HTTP Authentication

When running in HTTP mode (Docker), you can secure the MCP endpoint with Bearer token authentication:

# Set in .env or environment
MCP_AUTH_TOKEN=your-secret-token

When configured, all HTTP requests (except /health) must include the Authorization: Bearer <token> header. If not set, the server runs without authentication (backwards compatible).

Environment File Permissions

Protect your .env files containing API tokens:

chmod 600 .env .env.*

Dynamic Tool Dispatch Security

In dynamic mode, the tool dispatcher validates tool names:

  • Rejects private/internal functions (underscore-prefixed names)

  • Validates that resolved attributes are callable

  • Error responses never include request parameters (prevents credential leakage)

Safety Guardrails

The MCP server includes built-in safety checks to prevent accidental damage to managed infrastructure. Both are enabled by default.

Script Content Safety (FMG_SCRIPT_SAFETY)

Blocks dangerous CLI commands in create_script and update_script:

Blocked Command

Risk

execute factory-reset

Wipes device configuration

execute reboot

Causes device outage

execute shutdown

Powers off device

execute format

Formats device disk

execute erase-disk

Erases device disk

Handles FortiOS abbreviations (exec for execute) and case variations.

FMG_SCRIPT_SAFETY=strict    # Default: block dangerous commands
FMG_SCRIPT_SAFETY=disabled  # Allow all commands (use with extreme caution)

Policy Permissiveness Safety (FMG_POLICY_SAFETY)

Blocks overly permissive firewall policies in create_firewall_policy and update_firewall_policy. Detects policies where srcaddr=all + dstaddr=all + action=accept, which allows unrestricted traffic.

FMG_POLICY_SAFETY=strict    # Default: block overly permissive policies
FMG_POLICY_SAFETY=warn      # Allow but include warning in response
FMG_POLICY_SAFETY=disabled  # Allow all policies

Restore Safety (FMG_RESTORE_SAFETY)

Blocks trigger_fmg_restore (replaces FortiManager's entire configuration and interrupts the service) unless the caller also passes confirm=True.

FMG_RESTORE_SAFETY=strict    # Default: refuse without confirm=True
FMG_RESTORE_SAFETY=disabled  # Allow unconditionally

Revert Safety (FMG_REVERT_SAFETY)

Blocks revert_adom_revision (restores the entire live ADOM DB in one call) and revert_device_revision (rewrites a device's entire stored config from a revision) unless the caller also passes confirm=True.

FMG_REVERT_SAFETY=strict    # Default: refuse without confirm=True
FMG_REVERT_SAFETY=disabled  # Allow unconditionally

Firmware Upgrade Safety (FMG_FIRMWARE_SAFETY)

Blocks upgrade_device_firmware (reboots the real managed device) unless the caller also passes confirm=True. The same gate applies to add_model_device with a device blueprint that sets a firmware template or prefer-img-ver (FortiManager can install that version on the FortiGate when it registers), and to a saved blueprint that cannot be read to check.

FMG_FIRMWARE_SAFETY=strict    # Default: refuse without confirm=True
FMG_FIRMWARE_SAFETY=disabled  # Allow unconditionally

Security Profile Field Validation

create_firewall_policy and update_firewall_policy validate security-profile (UTM) field combinations before sending the payload to FortiManager, so an invalid combination fails with a clear message instead of an opaque FMG error code. This check always runs (no environment toggle):

  • profile_group is mutually exclusive with av_profile, ips_sensor, webfilter_profile, dnsfilter_profile, application_list, file_filter_profile, ssl_ssh_profile, and profile_protocol_options -- FortiOS rejects a policy that sets both a security-profile group and any individual profile it bundles. profile_protocol_options is itself a member of the firewall profile-group object, so it is part of this exclusion set too.

  • Setting any of the fields above together with utm_status=False in the same call is rejected -- FortiOS ignores security profiles when utm-status is disabled, so the combination is almost certainly a mistake.

General Security

  • API Tokens: Store tokens securely, never commit to version control

  • SSL Verification: Enable SSL verification in production environments

  • Least Privilege: Use FortiManager accounts with minimal required permissions

  • Network Security: Restrict access to FortiManager management interface

  • Workspace Locking: Use ADOM locking to prevent concurrent modifications

  • Credential Sanitization: Device credentials are automatically stripped from API responses

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines on how to submit bug reports, feature requests, and pull requests.

License

MIT License - See LICENSE file for details.

Acknowledgments

  • fortianalyzer-mcp - MCP server for FortiAnalyzer with 70+ tools

  • pyfmg - FortiManager/FortiAnalyzer Python library

Author

Roland Stierli

Available Tools

254 tools
add_deviceA

Add a new device to FortiManager.

Registers a device with FortiManager for central management. Can add either a real device (with IP) or a model device (with serial number).

Args: adom: ADOM name where device will be added name: Device display name ip: Device IP address (for real device connection) serial_number: Device serial number (for model device or validation) admin_user: Admin username for device connection admin_pass: Admin password for device connection description: Device description platform: Platform type (default: "FortiGate-VM64") mgmt_mode: Management mode - "fmg" (FortiManager only), or "fmgfaz" (both) flags: Additional flags like ["create_task"]

Returns: dict: Add result with keys: - status: "success" or "error" - device: Added device information - task_id: Task ID if run as background task - message: Error message if failed

Example: >>> # Add a FortiGate with IP >>> result = await add_device( ... adom="root", ... name="FGT-Branch1", ... ip="192.168.1.1", ... admin_user="admin", ... admin_pass="password123" ... )

>>> # Add a model device (offline provisioning)
>>> result = await add_device(
...     adom="root",
...     name="FGT-Lab",
...     serial_number="FGVM020000123456"
... )

Inputs: adom (required), name (required), ip, flags, +6 more. Returns: object

add_devices_bulkA

Add multiple devices to FortiManager in bulk.

Registers multiple devices at once for efficiency.

Args: adom: ADOM name where devices will be added devices: List of device configurations. Each device dict can contain: - name: Device display name (required) - ip: Device IP address - sn: Serial number - adm_usr: Admin username - adm_pass: Admin password - desc: Description - platform_str: Platform type - os_ver: OS version flags: Additional flags like ["create_task"]

Returns: dict: Bulk add result with keys: - status: "success" or "error" - requested_count: Number of devices in the request. NOT a count of devices actually added: the add runs as a task, so per-device results only exist once it completes. - task_id: Task ID if run as background task - message: Error message if failed

Example: >>> devices = [ ... {"name": "FGT-Site1", "ip": "192.0.2.1", "adm_usr": "admin", "adm_pass": "pass1"}, ... {"name": "FGT-Site2", "ip": "192.0.2.2", "adm_usr": "admin", "adm_pass": "pass2"}, ... ] >>> result = await add_devices_bulk("root", devices)

Inputs: adom (required), devices (required), flags. Returns: object

add_devices_to_group_bulkA

Add multiple devices to a device group in one call.

Non-destructive: existing group members are preserved. All devices are added on the same VDOM; call add_device_to_group individually for devices that need a different VDOM.

Args: adom: ADOM name group: Target device group name devices: List of device names to add vdom: VDOM to add each device on (default: "root")

Returns: dict: Add result with keys: - status: "success" or "error" - requested_count: Number of devices in the request. NOT a count of memberships actually changed: FortiManager reports no per-member result, so a device that does not exist or is already a member is indistinguishable from one that was added. - message: Status or error message

Example: >>> result = await add_devices_to_group_bulk( ... "root", "Branch-Firewalls", ["FGT-Site1", "FGT-Site2"] ... )

Inputs: adom (required), group (required), devices (required), vdom. Returns: object

add_device_to_groupA

Add a single device to a device group.

Non-destructive: existing group members are preserved.

Args: adom: ADOM name group: Target device group name device: Device name to add vdom: Device VDOM to add (default: "root")

Returns: dict: Add result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await add_device_to_group("root", "Branch-Firewalls", "FGT-Branch1")

Inputs: adom (required), group (required), device (required), vdom. Returns: object

add_group_to_groupA

Nest a device group inside another device group.

A group member has no VDOM (unlike a device member), which is what distinguishes a nested-group entry from a device entry in the dvmdb group membership list.

Args: adom: ADOM name parent_group: Group that will contain child_group child_group: Group to nest inside parent_group

Returns: dict: Add result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await add_group_to_group("root", "All-Branches", "Branch-Firewalls")

Inputs: adom (required), child_group (required), parent_group (required). Returns: object

add_ips_sensor_signature_overrideA

Add a signature filter/override entry to an IPS sensor.

FortiManager exposes an IPS sensor's "entries" list as its own addressable nested collection (its own add/get/set/update/delete/move endpoints under .../sensor/{sensor}/entries), so this calls that sub-resource's ADD endpoint directly rather than reading the whole sensor, splicing the list in Python, and writing it back -- unlike update_device_wtp_profile_radio's device-DB radio field, which has no such sub-resource and must be read-modify-written as a whole object.

Pass rule with explicit signature names to override specific signatures (e.g. ["trojan.generic"]); omit it and use severity / default_action / default_status to add a broad filter entry instead (matches every signature meeting those criteria).

Args: adom: ADOM name sensor: IPS sensor name (must already exist -- see create_ips_sensor) rule: Specific signature names to override (optional; omit for a broad filter entry) entry_id: Explicit entry ID (0-4294967295). If omitted, FortiManager assigns the next available ID. status: Status of the entry ("disable", "enable", or "default"; default: "enable") action: Action for matched traffic ("pass", "block", "reset", or "default"; default: "default") log: Enable/disable logging for this entry ("enable" or "disable") log_packet: Enable/disable packet logging for this entry ("enable" or "disable") severity: Signature severities to match (e.g. ["critical", "high"]) default_action: Broad-filter action filter ("block", "pass", or "all") default_status: Broad-filter status filter ("disable", "enable", or "all")

Returns: dict: Add result with keys: - status: "success" or "error" - sensor: Sensor name - message: Status or error message

Example: >>> # Override a specific signature to block+log >>> result = await add_ips_sensor_signature_override( ... adom="root", ... sensor="Custom-IPS", ... rule=["trojan.generic"], ... status="enable", ... action="block", ... log="enable", ... )

>>> # Add a broad "block all critical signatures" filter
>>> result = await add_ips_sensor_signature_override(
...     adom="root",
...     sensor="Custom-IPS",
...     severity=["critical"],
...     default_action="block",
...     status="enable",
...     action="block",
... )

Inputs: adom (required), sensor (required), log, rule, +7 more. Returns: object

add_model_deviceA

Add a model device for offline provisioning.

Model devices allow pre-configuring policies and settings before the actual device connects to FortiManager. Useful for zero-touch provisioning workflows.

With device_blueprint the new device inherits what the blueprint defines (template group, policy package, groups, enforced firmware...), and meta_variables supplies the per-device values its templates reference as $(name) -- the same fields the GUI "Add Model Device" dialog sends. Nothing is pushed to a real FortiGate: a model device is a placeholder until a FortiGate with this serial registers.

API coverage: device blueprint, patch and the HA attributes (ha_mode, ha_group_name, ha_slave) are in the bundled dvmcmd schema (7.2 to 8.0), the HA ones flagged internal; a model HA cluster was verified on FortiManager 8.0.2. The meta variables key is not in the bundled API reference: it is what the 8.0 GUI sends, verified on FortiManager 8.0.2, where each entry becomes a "global" per-device mapping and a name the ADOM does not have yet is created as a new metadata variable with an empty default (so a misspelt name leaves a stray variable behind; check names with list_metadata_variables).

The add is refused if the ADOM already has a device with this name or serial number. Safety: a blueprint that sets a firmware template or prefer-img-ver binds the device to a firmware version FortiManager can install on the FortiGate when it registers (a reboot), so under FMG_FIRMWARE_SAFETY=strict (default) it needs confirm=True, as upgrade_device_firmware does. So does a saved blueprint that cannot be read to check.

Args: adom: ADOM name where device will be added name: Device display name serial_number: Device serial number (e.g., "FGVM020000123456"); checked against the FortiGate/Fortinet serial format platform: Platform type (default: "FortiGate-VM64") os_version: FortiOS version, "7.4" or with patch "7.4.12" (default: "7.0") description: Device description device_blueprint: Name of a saved device blueprint, or an inline blueprint object (what the GUI sends with the blueprint option unchecked), e.g. {"pkg": "branch_pkg", "prov-type": "template-group", "template-group": "branch_templates", "dev-group": ["emea_spokes"], "prerun-cliprof": "bootstrap"}. Attributes follow fmg/device/blueprint; every object it names (package, template group, device groups, templates, CLI and authorization templates, firmware template) is looked up first and the add is refused if one does not exist. A saved blueprint name is checked the same way. meta_variables: Per-device meta-variable values, e.g. {"hostname": "b1", "branch_id": "1", "port3": "192.0.2.1/24"}. Values are strings or numbers, at most 255 characters, with no newlines or other control characters and none of ", \, #, {{, {%, {# or $( (templates paste them into CLI as is). Password-type values are masked in the result groups: Device group names to add the device to (root VDOM) ha_mode: Declare a model HA cluster: "AP" (active-passive) or "AA". name/serial_number are then the primary member and the cluster's device name in FMG. ha_group_name: HA cluster group name (required with ha_mode, max 36 characters) ha_priority: HA priority of the primary member (default 128) ha_members: Secondary members, each {"name": "branch3-1", "serial_number": "FGVM...", "priority": 100} flags: dvm/cmd/add/device flags, e.g. ["create_task"] (the GUI sends ["create_task", "nonblocking"]); the task ID is returned confirm: Must be True to add from a blueprint that enforces a firmware version, under FMG_FIRMWARE_SAFETY=strict (default). Ignored when FMG_FIRMWARE_SAFETY=disabled.

Returns: dict: Add result with keys: - status: "success" or "error" - device: Added device information - message: Status or error message

Example: >>> result = await add_model_device( ... adom="root", ... name="FGT-NewBranch", ... serial_number="FGVM02TM12345678", ... platform="FortiGate-60F", ... os_version="7.4" ... )

>>> # From a blueprint, with the variables its templates use
>>> result = await add_model_device(
...     adom="demo",
...     name="branch1",
...     serial_number="FGVM020000123456",
...     platform="FortiGate-VM64-KVM",
...     os_version="7.4.12",
...     device_blueprint="branch_standalone_blueprint",
...     meta_variables={"hostname": "branch1", "branch_id": "1"},
... )

>>> # A two-member active-passive model cluster
>>> result = await add_model_device(
...     adom="demo",
...     name="branch3",
...     serial_number="FGVM020000123457",
...     platform="FortiGate-VM64-KVM",
...     os_version="7.4.12",
...     device_blueprint="branch_cluster_blueprint",
...     ha_mode="AP",
...     ha_group_name="branch3_cluster",
...     ha_priority=200,
...     ha_members=[{"name": "branch3-1",
...                  "serial_number": "FGVM020000123458", "priority": 100}],
... )

Inputs: adom (required), name (required), serial_number (required), flags, +11 more. Returns: object

add_packet_captureA

Add a new FortiManager packet capture definition.

Creates a packet capture (sniffer) definition for traffic originating or destined to the FortiManager itself. The definition is created but not started -- call start_packet_capture() with the returned capture_id to begin capturing.

Args: interface: Interface to capture on (e.g. "port1") host: Filter by host address (optional, matches any host if unset) port: Filter by port or port range as a string, e.g. "80" or "1-1024" (optional) protocol: Filter by IP protocol number as a string, e.g. "6" for TCP (optional) vlan: Filter by VLAN ID as a string (optional) capture_ipv6: Include IPv6 traffic (default: False) capture_non_ip: Include non-IP traffic (default: False) max_packet_count: Maximum number of packets to capture (default: 4000, matching the FMG default)

Returns: dict: Create result with keys: - status: "success" or "error" - capture_id: ID of the created capture definition (FMG auto-assigns this) - message: Status or error message

Example: >>> result = await add_packet_capture(interface="port8", max_packet_count=300) >>> if result["status"] == "success": ... await start_packet_capture(result["capture_id"])

Inputs: interface (required), host, port, vlan, +4 more. Returns: object

assign_packageA

Assign a policy package to devices.

Associates a policy package with specific devices/VDOMs. The package can then be installed to these devices.

Args: adom: ADOM name package: Package name devices: Target devices [{"name": "FGT1", "vdom": "root"}, ...]

Returns: dict: Assignment result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await assign_package( ... adom="root", ... package="Branch-Policy", ... devices=[ ... {"name": "FGT-Branch1", "vdom": "root"}, ... {"name": "FGT-Branch2", "vdom": "root"} ... ] ... )

Inputs: adom (required), devices (required), package (required). Returns: object

assign_sdwan_templateC

Assign an SD-WAN template to a device.

Args: adom: ADOM name template: SD-WAN template name device: Device name to assign vdom: VDOM name (default: root)

Returns: Assignment result

Inputs: adom (required), device (required), template (required), vdom. Returns: object

assign_sdwan_template_bulkA

Assign an SD-WAN template to multiple devices.

Args: adom: ADOM name template: SD-WAN template name devices: List of devices [{"name": "dev1", "vdom": "root"}, ...]

Returns: dict: Assignment result with keys: - success: True - requested_count: Number of devices in the request. NOT a count of assignments actually made: FortiManager reports no per-device result for this scope-member ADD, and the client raises on any non-zero code, so everything reaching this line is a code 0 that says nothing about individual devices (same shape as #78's device-group bulk tools). - result: Raw client result

Inputs: adom (required), devices (required), template (required). Returns: object

assign_system_templateB

Assign a system template to a device.

Args: adom: ADOM name template: System template name device: Device name to assign vdom: VDOM name (default: root)

Returns: Assignment result

Inputs: adom (required), device (required), template (required), vdom. Returns: object

assign_system_template_bulkA

Assign a system template to multiple devices.

Args: adom: ADOM name template: System template name devices: List of devices [{"name": "dev1", "vdom": "root"}, ...]

Returns: dict: Assignment result with keys: - success: True - requested_count: Number of devices in the request. NOT a count of assignments actually made: FortiManager reports no per-device result for this scope-member ADD, and the client raises on any non-zero code, so everything reaching this line is a code 0 that says nothing about individual devices (same shape as #78's device-group bulk tools). - result: Raw client result

Inputs: adom (required), devices (required), template (required). Returns: object

assign_template_groupC

Assign a template group to a device.

Args: adom: ADOM name template_group: Template group name device: Device name vdom: VDOM name (default: root)

Returns: Assignment result

Inputs: adom (required), device (required), template_group (required), vdom. Returns: object

assign_vap_to_wtp_profileA

Add a VAP (SSID) to a FortiAP profile's radios so it gets broadcast.

Reads the profile, appends the VAP to each selected radio's manual VAP list, and switches that radio's vap-all mode to "manual" (the mode that honors an explicit list). VAPs already present are left in place.

Args: device: Managed device name profile: FortiAP (WTP) profile name vap: VAP object name to broadcast radios: Radios to add the SSID to, from 1-3 (default [1, 2]) vdom: VDOM the profile lives in (default "root")

Returns: Update result listing the radios changed

Inputs: vap (required), device (required), profile (required), vdom, +1 more. Returns: object

check_device_policy_syncA

Compare a device's firewall policies with its assigned policy package.

Reports, policy by policy, what differs between the package FortiManager has assigned to the device and what the device has. Read-only.

Two views of "what the device has", chosen with source:

  • revision: the latest device DB revision -- the configuration last retrieved from or installed to the device, i.e. what it runs.

  • device_db: FortiManager's current device DB, which also holds changes staged in FortiManager but not installed yet.

  • both (default): both comparisons, plus device DB vs revision -- a difference there is staged in FortiManager and not installed.

Only policies the package installs on this device count: install-on targets (devices and nested device groups) are resolved, and policy blocks are expanded in place. Policies only on the device side can be global header/footer policies or edits made on the device.

Args: adom: ADOM name device: Managed device name vdom: VDOM (default "root") package: Package to compare with (default: the one assigned to the device/VDOM) source: "revision", "device_db" or "both" (default) revision: Device DB revision to use (default -1, the latest; see list_device_revisions). Ignored for source="device_db".

Returns: dict: status, in_sync (all comparisons run), package, install_status, revision (number, time, comment), interface_mapping (normalized interfaces this device names differently), comparisons: {"package_vs_revision", "package_vs_device_db", "device_db_vs_revision"} as requested -- each with in_sync, summary, only_in_ lists, modified (field -> value per side) and order_matches -- and not_targeted (package policies scoped to other devices).

Example: >>> result = await check_device_policy_sync("demo", "branch1") >>> for p in result["comparisons"]["package_vs_revision"]["modified"]: ... print(p["policyid"], p["differences"])

Inputs: adom (required), device (required), vdom, source, +2 more. Returns: object

check_device_variablesA

Check a device's metadata variable values against what was imported.

Use after add_model_device to confirm every meta_variables entry landed as a per-device mapping. A device can hold one mapping per scope ("global" and a VDOM such as "root"). A variable is reported as:

  • match: every mapping the device has holds the expected value

  • mismatch: a device mapping holds another value; one entry per differing scope, named in vdom

  • not_mapped: no device mapping, so templates get the ADOM default

  • undefined: no such variable exists in the ADOM

Args: adom: ADOM name device: Device name (e.g. "branch1") expected: Variable name -> expected value, e.g. the CSV row {"branch_id": "1", "hostname": "branch1"}

Returns: dict: status, ok (all match), match / mismatch[{name, expected, actual, vdom}] / not_mapped / undefined lists

Inputs: adom (required), device (required), expected (required). Returns: object

clone_packageA

Clone a policy package.

Creates a copy of an existing package with all its policies and waits for FortiManager's clone task to finish.

Changed in 1.13.0: by default the clone is NOT assigned to any device (earlier releases asked FMG to keep the source's assignment), so it can be edited and reviewed without touching the devices that run the source package. Pass copy_installation_targets=True for the old behaviour. Each policy keeps its own "install on" targets either way: FMG clears them on an unassigned clone, so they are copied back from the source.

The new name is sent as dst_name, the parameter FNDN documents for /securityconsole/package/clone (7.2 through 8.0); earlier releases sent new_name, which is not a parameter of that command. The clone is created at the package root, so new_name is a plain name, not a folder path.

Args: adom: ADOM name package: Source package name (may be folder-qualified) new_name: Name for the cloned package, without a folder copy_installation_targets: Also copy the source package's device and group assignment (default: False) timeout: Seconds to wait for the clone task (10-600, default 120)

Returns: dict: Clone result with keys: - status: "success" or "error" - package: New package name - task_id: FMG clone task - installation_targets_copied: Whether the assignment was copied - policy_targets_restored: IDs of policies whose install-on targets were copied back from the source - warnings: Policies whose targets could not be restored - message: Status or error message

Example: >>> result = await clone_package( ... adom="root", ... package="default", ... new_name="default-copy" ... )

Inputs: adom (required), package (required), new_name (required), timeout, +1 more. Returns: object

commit_adomA

Commit changes to an ADOM (workspace mode).

Saves all pending changes made to the ADOM. Must be called before unlocking to persist changes.

Args: adom: ADOM name to commit

Returns: dict: Commit result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required). Returns: object

create_address_fqdnA

Create an FQDN (Fully Qualified Domain Name) address object.

FQDN addresses are resolved dynamically by FortiGate.

Args: adom: ADOM name name: Address object name fqdn: Domain name (e.g., "www.example.com") comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created address name - message: Status or error message

Example: >>> result = await create_address_fqdn( ... adom="root", ... name="Google-DNS", ... fqdn="dns.google.com" ... )

Inputs: adom (required), fqdn (required), name (required), comment. Returns: object

create_address_groupA

Create an address group.

Args: adom: ADOM name name: Group name members: List of address object names to include comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created group name - message: Status or error message

Example: >>> result = await create_address_group( ... adom="root", ... name="Web-Servers", ... members=["WebServer1", "WebServer2", "WebServer3"], ... comment="Production web servers" ... )

Inputs: adom (required), name (required), members (required), comment. Returns: object

create_address_hostA

Create a host address object (single IP).

Args: adom: ADOM name name: Address object name ip: Host IP address (e.g., "10.0.0.100") comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created address name - message: Status or error message

Example: >>> result = await create_address_host( ... adom="root", ... name="WebServer", ... ip="192.168.1.100", ... comment="Production web server" ... )

Inputs: ip (required), adom (required), name (required), comment. Returns: object

create_address_rangeA

Create an IP range address object.

Args: adom: ADOM name name: Address object name start_ip: Start IP address end_ip: End IP address comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created address name - message: Status or error message

Example: >>> result = await create_address_range( ... adom="root", ... name="DHCP-Pool", ... start_ip="192.168.1.100", ... end_ip="192.168.1.200" ... )

Inputs: adom (required), name (required), end_ip (required), start_ip (required), +1 more. Returns: object

create_address_subnetA

Create a subnet/network address object.

Args: adom: ADOM name name: Address object name subnet: IP/netmask (e.g., "10.0.0.0/24" or "10.0.0.0 255.255.255.0") comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created address name - message: Status or error message

Example: >>> result = await create_address_subnet( ... adom="root", ... name="LAN-Subnet", ... subnet="192.168.1.0/24", ... comment="Local network" ... )

Inputs: adom (required), name (required), subnet (required), comment. Returns: object

create_antivirus_profileA

Create an antivirus profile.

Args: adom: ADOM name name: Profile name comment: Optional comment feature_set: Flow/proxy feature set - "proxy" or "flow" (optional) scan_mode: Scan mode - "default" or "legacy" (optional) av_virus_log: Enable/disable AntiVirus logging - "enable" or "disable" (optional)

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created profile name - message: Status or error message

Example: >>> result = await create_antivirus_profile( ... adom="root", ... name="strict-av", ... feature_set="flow", ... av_virus_log="enable", ... )

Inputs: adom (required), name (required), comment, scan_mode, +2 more. Returns: object

create_application_listB

Create an application-control list.

Args: adom: ADOM name name: List name comment: Optional comment deep_app_inspection: Enable/disable deep application inspection - "enable" or "disable" (optional) unknown_application_action: Pass or block traffic from unknown applications - "pass" or "block" (optional) other_application_action: Action for other applications - "pass" or "block" (optional)

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created list name - message: Status or error message

Example: >>> result = await create_application_list( ... adom="root", ... name="strict-appctrl", ... unknown_application_action="block", ... other_application_action="block", ... )

Inputs: adom (required), name (required), comment, deep_app_inspection, +2 more. Returns: object

create_cli_template_groupB

Create a new CLI template group.

Args: adom: ADOM name name: CLI template group name description: Optional description

Returns: Created CLI template group

Inputs: adom (required), name (required), description. Returns: object

create_device_dhcp_serverA

Create a DHCP server scope in a device's device DB.

Args: device: Managed device name interface: Interface the scope serves (e.g. "vlan15") start_ip: First address of the lease range end_ip: Last address of the lease range netmask: Scope netmask (e.g. "255.255.255.0") default_gateway: Gateway handed to clients (defaults to the interface address if omitted, per FortiOS behavior) dns_servers: Up to three DNS servers to hand out; omitted means the device's system DNS is used (dns-service default) lease_time: Lease time in seconds vdom: VDOM the scope lives in (default "root")

Returns: Creation result including the new scope id

Inputs: device (required), end_ip (required), netmask (required), start_ip (required), +5 more. Returns: object

create_device_groupA

Create a device group in FortiManager's device manager database.

Device groups organize managed devices (and other groups) for bulk operations like policy installation. This is a dvmdb object -- creation does not touch any live device.

Args: adom: ADOM name where the group will be created name: Group name (dvmdb group.name, master key) os_type: Device platform family the group targets (default: "unknown"). One of: unknown, fos, fsw, foc, fml, faz, fwb, fch, fct, log, fmg, fsa, fdd, fac, fpx, fna, ffw, fsr, fad, fdc, fap, fxt, fts, fai, fwc, fis, fed, fpa, fca, ftc, fss, fra, sim, fdt. description: Optional group description

Returns: dict: Create result with keys: - status: "success" or "error" - group: Created group name/adom - message: Status or error message

Example: >>> result = await create_device_group( ... adom="root", ... name="Branch-Firewalls", ... os_type="fos", ... description="All branch FortiGates", ... )

Inputs: adom (required), name (required), os_type, description. Returns: object

create_device_interfaceA

Create a VLAN subinterface in a device's device DB.

Reads back with get_device_interface_config; push to the FortiGate with preview_install + install_device_settings.

Args: device: Managed device name name: New interface name (e.g. "vlan15") parent: Physical/aggregate parent interface (e.g. "internal") vlanid: VLAN id (1-4094) ip: Interface address, CIDR ("192.0.2.254/24") or "address netmask" allowaccess: Administrative access to allow (e.g. ["ping", "https"]) role: Interface role: lan, wan, dmz or undefined alias: Short alias shown in the GUI vdom: VDOM the interface belongs to (default "root") description: Interface description

Returns: Creation result

Inputs: name (required), device (required), parent (required), vlanid (required), +6 more. Returns: object

create_device_ipsec_phase1_interfaceA

Create an IPsec phase1-interface (remote gateway / IKE SA) in a device's device DB.

Route-based (interface-mode) tunnel only -- this always writes an interface (the outgoing local interface), matching the phase1-interface table this tool targets rather than the legacy policy-based phase1 table.

Args: device: Managed device name name: New phase1-interface (remote gateway) name interface: Local physical/aggregate/loopback/VLAN outgoing interface type: Remote gateway type: "static", "dynamic" or "ddns"; default "static" remote_gw: Remote gateway's external IPv4 address. Required when type is "static" -- a static gateway with no address cannot connect psksecret: Pre-shared key for PSK authentication, 6-128 characters ike_version: IKE protocol version, "1" or "2" mode: IKEv1 ID protection mode: "main" or "aggressive" (ignored on IKEv2) peertype: Peer ID acceptance: "any", "one", "dialup", "peer" or "peergrp". Defaults to "any" when type is "static" and no value is given -- live-verified against FMG 7.6.7: a static PSK gateway created without peertype is rejected with "peer invalid value", so this tool supplies the working default rather than surfacing that error to the caller proposal: Phase1 encryption/authentication proposal list (e.g. ["aes256-sha256"]). Values are passed through to FortiManager largely unvalidated -- see module docstring dhgrp: Phase1 Diffie-Hellman group list (e.g. ["14", "21"]). Same pass-through as proposal nattraversal: NAT traversal: "disable", "enable" or "forced" dpd: Dead Peer Detection mode: "disable", "on-idle" or "on-demand" keylife: Phase1 key life in seconds comments: Free-text comment vdom: VDOM the gateway lives in (default "root")

Returns: Creation result with any echoed credential stripped

Inputs: name (required), device (required), interface (required), dpd, +12 more. Returns: object

create_device_ipsec_phase2_interfaceA

Create an IPsec phase2-interface (tunnel/traffic selector) in a device's device DB.

Args: device: Managed device name name: New phase2-interface (tunnel) name phase1name: Parent phase1-interface (remote gateway) name this tunnel is negotiated under src_subnet: Local proxy ID subnet, CIDR ("192.168.1.0/24") or "address netmask" form. Omitted means the FortiOS default (0.0.0.0/0, the whole local network) dst_subnet: Remote proxy ID subnet, same accepted forms. Omitted means the FortiOS default (0.0.0.0/0) proposal: Phase2 encryption/authentication proposal list (e.g. ["aes256-sha256"]). Pass-through, see module docstring dhgrp: Phase2 PFS Diffie-Hellman group list. Pass-through, see module docstring pfs: Perfect Forward Secrecy: "disable" or "enable" replay: Replay detection: "disable" or "enable" keepalive: Keep-alive: "disable" or "enable" auto_negotiate: IPsec SA auto-negotiation: "disable" or "enable" keylifeseconds: Phase2 key life in seconds (120-172800) comments: Free-text comment vdom: VDOM the tunnel lives in (default "root")

Returns: Creation result

Inputs: name (required), device (required), phase1name (required), pfs, +10 more. Returns: object

create_device_on_demand_snifferA

Create a bounded on-demand packet sniffer on a managed device.

Distinct FortiOS object from create_device_sniffer's firewall sniffer: this one (firewall on-demand-sniffer) is name-keyed rather than id-keyed, and bounded by max_packet_count rather than running continuously -- closer to a one-shot capture job than a standing diagnostic rule. Filters are lists (multiple hosts/ports/ protocols at once), not the single range-string form the persistent sniffer uses.

How to actually trigger the capture and retrieve packets once this definition exists is not part of FortiOS's Configuration API (this tool only stages the definition, config-CRUD like every other tool in this module) -- that would be a separate monitor-API or CLI mechanism, out of scope here.

Args: device: Managed device name name: On-demand sniffer name interface: Interface name traffic sniffing takes place on max_packet_count: Maximum packets to capture (default: 4000) hosts: IPv4/IPv6 hosts to filter for ports: Ports to filter for (each 1-65535) protocols: IANA protocol numbers to filter for (each 0-255) capture_non_ip: Include non-IP packets (default: False) vdom: VDOM the sniffer lives in (default "root")

Returns: Creation result

Inputs: name (required), device (required), interface (required), vdom, +5 more. Returns: object

create_device_snifferA

Create a firewall sniffer definition on a managed device.

This targets the FortiGate's own persistent firewall sniffer object (device-DB, Configuration API firewall.json /firewall/sniffer) so the capture actually runs on the device's own traffic -- not FortiManager's separate, unrelated local diagnostic sniffer (/cli/global/system/sniffer, a different object that happens to share a name). Unlike FMG's local sniffer there is no packet-count cap or start/stop action: the definition captures continuously while status is "enable", same as any other persistent FortiOS config object -- disable or delete it to stop.

Args: device: Managed device name interface: Interface name traffic sniffing takes place on host: Hosts to filter for (e.g. "1.1.1.1", "2.2.2.0/24") port: Ports to sniff (e.g. "80", "1-1024") protocol: IANA protocol number as a string (e.g. "6" for TCP) vlan: VLAN(s) to sniff capture_ipv6: Include IPv6 packets (default: False) capture_non_ip: Include non-IP packets (default: False) status: "enable" or "disable" (default: "enable") logtraffic: "all", "utm", or "disable" (optional) sniffer_id: Explicit sniffer ID (0-9999); omit to let FortiOS assign the next available one vdom: VDOM the sniffer lives in (default "root")

Returns: Creation result including the new sniffer id

Inputs: device (required), interface (required), host, port, +8 more. Returns: object

create_device_vapA

Create a wireless VAP (SSID) in a device's device DB.

The VAP becomes broadcastable once added to a FortiAP profile (assign_vap_to_wtp_profile).

Args: device: Managed device name name: VAP object name ssid: SSID to broadcast security: Security mode, a FortiOS wireless-controller vap security enum value; default "wpa2-only-personal". Supported here: the personal modes ("wpa-personal", "wpa-only-personal", "wpa2-only-personal"), the SAE modes ("wpa3-sae", "wpa3-sae-transition"), "owe" and "open". Enterprise and WEP modes are refused, since neither a radius/user-group nor a WEP key is set by this tool. passphrase: Credential, 8-63 characters, required by the personal and SAE modes. It is sent as passphrase for the personal modes and as sae-password for SAE; transition mode carries both, since it runs a WPA2 leg alongside SAE. vlanid: VLAN id to map wireless clients into vdom: VDOM the VAP lives in (default "root")

Returns: Creation result with any echoed passphrase stripped

Inputs: name (required), ssid (required), device (required), vdom, +3 more. Returns: object

create_device_wtpA

Register a managed FortiAP in a device's device DB.

This is the wireless-controller.wtp table: the mapping from a physical AP's serial number to the profile it runs. A wtp-profile that exists in the device DB but is not referenced by any wtp entry is pruned by FortiManager on install, so registering the AP here is required before a profile-only setup survives install_device_settings.

Args: device: Managed device name wtp_id: FortiAP serial number (the wtp-id / table mkey) wtp_profile: FortiAP (WTP) profile name to assign name: Friendly display name admin: Authorization state: "discovered" (awaiting authorization), "enable" (authorized) or "disable"; default "discovered" location: Free-text location string comment: Free-text comment vdom: VDOM to register the AP in (default "root")

Returns: Creation result

Inputs: device (required), wtp_id (required), wtp_profile (required), name, +4 more. Returns: object

create_dlp_profileA

Create a DLP (Data Loss Prevention) profile.

The profile is created without rules. Rule management (config dlp profile / rule) is out of scope for this tool; add rules via the FortiManager GUI/CLI or a follow-up tool once this profile exists.

Args: adom: ADOM name name: Profile name comment: Optional comment feature_set: Flow or proxy-based inspection ("flow" or "proxy") dlp_log: Enable/disable DLP logging ("enable" or "disable") extended_log: Enable/disable extended logging ("enable" or "disable")

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created profile name - message: Status or error message

Example: >>> result = await create_dlp_profile( ... adom="root", ... name="Custom-DLP", ... feature_set="flow", ... dlp_log="enable", ... )

Inputs: adom (required), name (required), comment, dlp_log, +2 more. Returns: object

create_dnsfilter_profileB

Create a DNS filter profile.

Args: adom: ADOM name name: Profile name comment: Optional comment block_action: Action for blocked domains - "block", "redirect", or "block-sevrfail" (optional) block_botnet: Enable/disable blocking botnet C&C DNS lookups - "enable" or "disable" (optional) safe_search: Enable/disable Google/Bing/YouTube/etc. safe search - "enable" or "disable" (optional)

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created profile name - message: Status or error message

Example: >>> result = await create_dnsfilter_profile( ... adom="root", ... name="strict-dns", ... block_botnet="enable", ... safe_search="enable", ... )

Inputs: adom (required), name (required), comment, safe_search, +2 more. Returns: object

create_firewall_policyA

Create a new firewall policy.

Creates a firewall policy in the specified policy package. The policy won't be active until the package is installed to devices.

Args: adom: ADOM name package: Policy package name name: Policy name srcintf: Source interfaces (e.g., ["internal"]) dstintf: Destination interfaces (e.g., ["wan1"]) srcaddr: Source addresses (e.g., ["all"]) dstaddr: Destination addresses (e.g., ["all"]) service: Services (e.g., ["ALL", "HTTP", "HTTPS"]) action: Policy action - "accept" or "deny" (default: "accept") schedule: Schedule object name (default: "always") nat: Enable NAT (default: False) logtraffic: Log mode - "all", "utm", or "disable" (default: "utm") status: Policy status - "enable" or "disable" (default: "enable") comments: Policy comments (optional) policyid: Specific policy ID (optional, auto-assigned if not set) srcaddr_negate: Match all sources EXCEPT srcaddr (optional; omitted from the payload when not set, leaving the FortiManager default) dstaddr_negate: Match all destinations EXCEPT dstaddr (optional) service_negate: Match all services EXCEPT service (optional) utm_status: Enable/disable security profile inspection on this policy (optional). Required (True) for any of the profile fields below to actually apply. av_profile: Antivirus profile name, e.g. "default" (optional) ips_sensor: IPS sensor name, e.g. "default" (optional) webfilter_profile: Web filter profile name (optional) dnsfilter_profile: DNS filter profile name (optional) application_list: Application control list name (optional) file_filter_profile: File filter profile name (optional) ssl_ssh_profile: SSL/SSH inspection profile name, e.g. "certificate-inspection" (optional) profile_protocol_options: Protocol options profile name (optional). Mutually exclusive with profile_group -- it is itself a member of the FortiOS firewall profile-group object, so FortiOS rejects setting both profile_group: Security profile group name (optional). Mutually exclusive with av_profile, ips_sensor, webfilter_profile, dnsfilter_profile, application_list, file_filter_profile, ssl_ssh_profile, and profile_protocol_options -- FortiOS rejects setting both install_on: Install the policy only on these targets (optional; by default it installs on every device the package goes to). Each entry is a device {"name": "branch1", "vdom": "root"} or a device group {"name": "emea_spokes"}

Returns: dict: Create result with keys: - status: "success" or "error" - policyid: Created policy ID - message: Status or error message

Example: >>> result = await create_firewall_policy( ... adom="root", ... package="default", ... name="Allow-Web-Traffic", ... srcintf=["internal"], ... dstintf=["wan1"], ... srcaddr=["LAN-Subnet"], ... dstaddr=["all"], ... service=["HTTP", "HTTPS"], ... action="accept", ... nat=True, ... utm_status=True, ... av_profile="default", ... ips_sensor="default", ... )

Inputs: adom (required), name (required), dstaddr (required), dstintf (required), +25 more. Returns: object

create_firmware_templateA

Create a firmware template (not assigned to any device).

Each version is checked against the platform's firmware catalog, so the template can only enforce an image FortiManager can actually get. Assigning the template is a separate step, done in the GUI: once assigned, FortiManager upgrades (or downgrades) the devices to the enforced version in the schedule window.

Verified on FortiManager 8.0.2; the template table is not in the bundled API reference, so other versions may refuse it (reported as firmware_templates_unavailable).

Args: name: Template name versions: Enforced versions, one per platform: [{"platform": "FortiGate-VM64-KVM", "version": "7.4.9"}]. The version may include the build ("7.4.9-b2829") adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") description: Optional description image_source: "fds" (FortiGuard, default) or "fmg" (images on FortiManager) schedule_type: "daily" (default) or "weekly" schedule_start_time: Window start, "HH:MM" (default "00:00") schedule_end_time: Window end, "HH:MM" (default "23:59") schedule_days: Days for a weekly schedule, e.g. ["saturday", "sunday"]

Returns: dict: status, template (as list_firmware_templates shows it), message

Inputs: name (required), versions (required), adom, description, +5 more. Returns: object

create_ips_sensorA

Create an IPS sensor.

The sensor is created empty (no signature filters/overrides). Use add_ips_sensor_signature_override to populate it afterward.

Args: adom: ADOM name name: Sensor name comment: Optional comment block_malicious_url: Enable/disable malicious URL blocking ("enable" or "disable") scan_botnet_connections: Botnet-server connection handling ("disable", "block", or "monitor") extended_log: Enable/disable extended logging ("enable" or "disable")

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created sensor name - message: Status or error message

Example: >>> result = await create_ips_sensor( ... adom="root", ... name="Custom-IPS", ... scan_botnet_connections="block", ... comment="Baseline IPS sensor", ... )

Inputs: adom (required), name (required), comment, extended_log, +2 more. Returns: object

create_local_in_policyA

Create a new IPv4 local-in policy.

Local-in policies control traffic destined to the FortiGate's own management plane (GUI, SSH, ping, API, SNMP, etc.) -- a distinct object space from the regular firewall/policy table (create_firewall_policy), which governs traffic passing through the device. There is no srcintf/dstintf pair here: intf is the single incoming interface, since local-in traffic terminates on the FortiGate itself rather than being forwarded. A local-in policy only takes effect once its package is installed to a device (see preview_install / install_package).

Args: adom: ADOM name package: Policy package name intf: Incoming interface(s) this policy applies to, e.g. ["port1"] srcaddr: Source addresses this policy matches (e.g. ["Admin-Subnet"]) dstaddr: Destination addresses on the FortiGate itself (e.g. ["all"]) service: Services this policy matches, e.g. ["HTTPS", "SSH"] action: Policy action - "accept" or "deny" (default: "deny", the FortiOS field default -- unlike create_firewall_policy this defaults closed since it governs management-plane access) schedule: Schedule object name(s) (default: ["always"] if omitted) status: Policy status - "enable" or "disable" (default: "enable") logtraffic: Local-in traffic logging - "enable" or "disable" (optional) comments: Policy comments (optional) policyid: Specific policy ID (optional, auto-assigned if not set) srcaddr_negate: Match all sources EXCEPT srcaddr (optional) dstaddr_negate: Match all destinations EXCEPT dstaddr (optional) service_negate: Match all services EXCEPT service (optional) ha_mgmt_intf_only: Restrict this policy to the HA management interface only (optional). IPv4-only field -- there is no equivalent on create_local_in_policy6. virtual_patch: Enable/disable virtual patching on this policy (optional)

Returns: dict: Create result with keys: - status: "success" or "error" - policyid: Created policy ID - message: Status or error message

Example: >>> result = await create_local_in_policy( ... adom="root", ... package="default", ... intf=["port1"], ... srcaddr=["Admin-Subnet"], ... dstaddr=["all"], ... service=["HTTPS", "SSH"], ... action="accept", ... )

Inputs: adom (required), intf (required), dstaddr (required), package (required), +13 more. Returns: object

create_local_in_policy6A

Create a new IPv6 local-in policy.

IPv6 counterpart of create_local_in_policy -- see that tool's docstring for the local-in-policy concept. srcaddr/dstaddr reference IPv6 address objects here. There is no ha_mgmt_intf_only field on this object type (it is IPv4-only on the appliance).

Args: adom: ADOM name package: Policy package name intf: Incoming interface(s) this policy applies to, e.g. ["port1"] srcaddr: Source IPv6 addresses this policy matches dstaddr: Destination IPv6 addresses on the FortiGate itself (e.g. ["all"]) service: Services this policy matches, e.g. ["HTTPS", "SSH"] action: Policy action - "accept" or "deny" (default: "deny", the FortiOS field default) schedule: Schedule object name(s) (default: ["always"] if omitted) status: Policy status - "enable" or "disable" (default: "enable") logtraffic: Local-in traffic logging - "enable" or "disable" (optional) comments: Policy comments (optional) policyid: Specific policy ID (optional, auto-assigned if not set) srcaddr_negate: Match all sources EXCEPT srcaddr (optional) dstaddr_negate: Match all destinations EXCEPT dstaddr (optional) service_negate: Match all services EXCEPT service (optional) virtual_patch: Enable/disable virtual patching on this policy (optional)

Returns: dict: Create result with keys: - status: "success" or "error" - policyid: Created policy ID - message: Status or error message

Example: >>> result = await create_local_in_policy6( ... adom="root", ... package="default", ... intf=["port1"], ... srcaddr=["Admin-Subnet-v6"], ... dstaddr=["all"], ... service=["HTTPS", "SSH"], ... action="accept", ... )

Inputs: adom (required), intf (required), dstaddr (required), package (required), +12 more. Returns: object

create_packageA

Create a new policy package.

Policy packages contain firewall policies, security profiles, and other configurations to be deployed to managed devices.

Args: adom: ADOM name name: Package name ngfw_mode: NGFW mode - "profile-based" (default) or "policy-based" central_nat: Enable central NAT (default: False)

Returns: dict: Create result with keys: - status: "success" or "error" - package: Created package name - message: Status or error message

Example: >>> result = await create_package( ... adom="root", ... name="Branch-Policy", ... ngfw_mode="profile-based" ... )

Inputs: adom (required), name (required), ngfw_mode, central_nat. Returns: object

create_scriptB

Create a new CLI script.

Args: adom: ADOM name name: Script name content: Script content (CLI commands) script_type: Script type - cli, tcl, cligrp, tclgrp, jinja (default: cli) target: Execution target (default: device_database) - device_database: Device Database - adom_database: Policy Package or ADOM Database - remote_device: Remote FortiGate Directly (via CLI) description: Script description

Returns: Created script details

Inputs: adom (required), name (required), content (required), target, +2 more. Returns: object

create_sdwan_templateB

Create a new SD-WAN template.

Creates an empty SD-WAN template that can be configured with interfaces, SLAs, and routing rules.

Args: adom: ADOM name name: SD-WAN template name description: Optional description

Returns: Created SD-WAN template

Inputs: adom (required), name (required), description. Returns: object

create_service_groupA

Create a service group.

Args: adom: ADOM name name: Group name members: List of service names to include comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created group name - message: Status or error message

Example: >>> result = await create_service_group( ... adom="root", ... name="Web-Services", ... members=["HTTP", "HTTPS", "DNS"], ... comment="Common web services" ... )

Inputs: adom (required), name (required), members (required), comment. Returns: object

create_service_icmpA

Create an ICMP service object.

Args: adom: ADOM name name: Service object name icmp_type: ICMP type (0-255, optional for all types) icmp_code: ICMP code (0-255, optional) comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created service name - message: Status or error message

Example: >>> # Create ping service (ICMP echo request) >>> result = await create_service_icmp( ... adom="root", ... name="Custom-Ping", ... icmp_type=8, ... comment="ICMP Echo Request" ... )

Inputs: adom (required), name (required), comment, icmp_code, +1 more. Returns: object

create_service_tcp_udpA

Create a TCP/UDP/SCTP/UDP-Lite service object.

Args: adom: ADOM name name: Service object name tcp_portrange: TCP port range (e.g., "80", "8080-8090", "80 443 8080") udp_portrange: UDP port range (e.g., "53", "500-502") sctp_portrange: SCTP port range (e.g., "3868", "2905-2907") udplite_portrange: UDP-Lite port range (e.g., "1234") comment: Optional comment

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created service name - message: Status or error message

Example: >>> # Create HTTP/HTTPS service >>> result = await create_service_tcp_udp( ... adom="root", ... name="Custom-Web", ... tcp_portrange="80 443 8080", ... comment="Custom web ports" ... )

>>> # Create DNS service
>>> result = await create_service_tcp_udp(
...     adom="root",
...     name="Custom-DNS",
...     tcp_portrange="53",
...     udp_portrange="53"
... )

>>> # Create SCTP service (Diameter)
>>> result = await create_service_tcp_udp(
...     adom="root",
...     name="Diameter",
...     sctp_portrange="3868",
...     comment="Diameter protocol"
... )

Inputs: adom (required), name (required), comment, tcp_portrange, +3 more. Returns: object

create_ssl_ssh_profileB

Create an SSL/SSH inspection profile.

Args: adom: ADOM name name: Profile name comment: Optional comment ssl_inspection: Generic SSL inspection level ("disable", "certificate-inspection", or "deep-inspection") https_inspection: HTTPS inspection level ("disable", "certificate-inspection", or "deep-inspection") caname: CA certificate(s) used for SSL inspection (datasource names) untrusted_caname: Untrusted CA certificate(s) (datasource names) server_cert: Certificate(s) used to replace the server certificate (datasource names; only used when server_cert_mode="replace") server_cert_mode: Re-sign or replace the server's certificate ("re-sign" or "replace") mapi_over_https: Enable/disable inspection of MAPI over HTTPS rpc_over_https: Enable/disable inspection of RPC over HTTPS

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created profile name - message: Status or error message

Example: >>> result = await create_ssl_ssh_profile( ... adom="root", ... name="Custom-Deep-Inspection", ... ssl_inspection="deep-inspection", ... https_inspection="deep-inspection", ... server_cert_mode="re-sign", ... comment="Deep inspection for outbound web traffic", ... )

Inputs: adom (required), name (required), caname, comment, +7 more. Returns: object

create_waf_profileA

Create a WAF (Web Application Firewall) profile.

The profile is created with FortiManager/FortiOS defaults for its nested signature/constraint/method/url-access sections. Fine-grained control of those sections is out of scope for this tool; adjust them via the FortiManager GUI/CLI or a follow-up tool once this profile exists.

Args: adom: ADOM name name: Profile name comment: Optional comment external: Enable/disable external HTTP inspection ("enable" or "disable") extended_log: Enable/disable extended logging ("enable" or "disable")

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created profile name - message: Status or error message

Example: >>> result = await create_waf_profile( ... adom="root", ... name="Custom-WAF", ... extended_log="enable", ... comment="Baseline WAF profile", ... )

Inputs: adom (required), name (required), comment, external, +1 more. Returns: object

create_webfilter_profileB

Create a web filter profile.

Args: adom: ADOM name name: Profile name comment: Optional comment feature_set: Flow/proxy feature set - "proxy" or "flow" (optional) log_all_url: Enable/disable logging all URLs visited - "enable" or "disable" (optional) web_content_log: Enable/disable logging blocked web content - "enable" or "disable" (optional)

Returns: dict: Create result with keys: - status: "success" or "error" - name: Created profile name - message: Status or error message

Example: >>> result = await create_webfilter_profile( ... adom="root", ... name="strict-web", ... feature_set="flow", ... log_all_url="enable", ... )

Inputs: adom (required), name (required), comment, feature_set, +2 more. Returns: object

delete_addressA

Delete a firewall address object.

WARNING: This will fail if the address is in use by policies or groups.

Args: adom: ADOM name name: Address object name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_address_groupA

Delete an address group.

WARNING: This will fail if the group is in use by policies.

Args: adom: ADOM name name: Group name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_antivirus_profileB

Delete an antivirus profile.

WARNING: This will fail if the profile is in use by firewall policies.

Args: adom: ADOM name name: Profile name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_application_listA

Delete an application-control list.

WARNING: This will fail if the list is in use by firewall policies.

Args: adom: ADOM name name: List name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_cli_template_groupB

Delete a CLI template group.

Args: adom: ADOM name name: CLI template group name

Returns: Deletion result

Inputs: adom (required), name (required). Returns: object

delete_deviceA

Delete a device from FortiManager.

Removes a device registration. Does not affect the actual device or its configuration - only removes it from FortiManager management.

WARNING: This operation cannot be undone.

Args: adom: ADOM name where device is located device: Device name to delete flags: Additional flags like ["create_task"]

Returns: dict: Delete result with keys: - status: "success" or "error" - task_id: Task ID if run as background task - message: Status or error message

Example: >>> result = await delete_device("root", "FGT-OldBranch") >>> if result['status'] == 'success': ... print("Device removed from FortiManager")

Inputs: adom (required), device (required), flags. Returns: object

delete_device_dhcp_serverA

Delete a DHCP server scope from a device's device DB.

Args: device: Managed device name dhcp_server_id: Numeric scope id (see list_device_dhcp_servers) vdom: VDOM the scope lives in (default "root")

Returns: Deletion result

Inputs: device (required), dhcp_server_id (required), vdom. Returns: object

delete_device_groupA

Delete a device group from FortiManager.

Removes the group object itself. Member devices are not affected -- only their group membership is removed.

WARNING: This operation cannot be undone.

Args: adom: ADOM name where the group is located name: Group name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await delete_device_group("root", "Branch-Firewalls")

Inputs: adom (required), name (required). Returns: object

delete_device_interfaceC

Delete an interface from a device's device DB.

Args: device: Managed device name name: Interface name to delete

Returns: Deletion result

Inputs: name (required), device (required). Returns: object

delete_device_ipsec_phase1_interfaceA

Delete an IPsec phase1-interface from a device's device DB.

Any phase2-interface still pointing at this phase1name should be deleted first (delete_device_ipsec_phase2_interface) -- FortiManager rejects deleting a phase1-interface a phase2-interface still references.

Args: device: Managed device name name: Phase1-interface (remote gateway) name to delete vdom: VDOM it lives in (default "root")

Returns: Deletion result

Inputs: name (required), device (required), vdom. Returns: object

delete_device_ipsec_phase2_interfaceB

Delete an IPsec phase2-interface from a device's device DB.

Args: device: Managed device name name: Phase2-interface (tunnel) name to delete vdom: VDOM it lives in (default "root")

Returns: Deletion result

Inputs: name (required), device (required), vdom. Returns: object

delete_devices_bulkA

Delete multiple devices from FortiManager in bulk.

Removes multiple device registrations at once.

WARNING: This operation cannot be undone.

Args: adom: ADOM name where devices are located devices: List of device names to delete flags: Additional flags like ["create_task"]

Returns: dict: Bulk delete result with keys: - status: "success" or "error" - requested_count: Number of devices in the request. NOT a count of devices actually deleted: the delete runs as a task, so per-device results only exist once it completes. - task_id: Task ID if run as background task - message: Error message if failed

Example: >>> result = await delete_devices_bulk("root", ["FGT-Old1", "FGT-Old2"])

Inputs: adom (required), devices (required), flags. Returns: object

delete_device_vapA

Delete a wireless VAP from a device's device DB.

Args: device: Managed device name name: VAP object name to delete vdom: VDOM the VAP lives in (default "root")

Returns: Deletion result

Inputs: name (required), device (required), vdom. Returns: object

delete_device_wtpA

Delete a managed FortiAP registration from a device's device DB.

This drops the AP's reference to its wtp-profile. FortiManager prunes a wtp-profile that no wtp entry references on install (see create_device_wtp), so deleting the last AP on a profile loses that profile on the next install_device_settings.

Args: device: Managed device name wtp_id: FortiAP serial number (the wtp-id / table mkey) vdom: VDOM the AP is registered in (default "root")

Returns: Deletion result

Inputs: device (required), wtp_id (required), vdom. Returns: object

delete_dlp_profileA

Delete a DLP profile.

WARNING: This will fail if the profile is in use by policies.

Args: adom: ADOM name name: Profile name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_dnsfilter_profileB

Delete a DNS filter profile.

WARNING: This will fail if the profile is in use by firewall policies.

Args: adom: ADOM name name: Profile name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_firewall_policies_bulkA

Delete multiple firewall policies at once.

WARNING: This operation cannot be undone.

Args: adom: ADOM name package: Policy package name policyids: List of policy IDs to delete

Returns: dict: Delete result with keys: - status: "success", "partial", or "error" - deleted_count: Number of policies deleted - deleted: Policy IDs that were deleted - failed: Per-item failures [{"policyid", "message", "error_code"}, ...] - message: Status or error message

Example: >>> result = await delete_firewall_policies_bulk( ... adom="root", ... package="default", ... policyids=[5, 6, 7, 8] ... )

Inputs: adom (required), package (required), policyids (required). Returns: object

delete_firewall_policyA

Delete a firewall policy.

WARNING: This operation cannot be undone.

Args: adom: ADOM name package: Policy package name policyid: Policy ID to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), package (required), policyid (required). Returns: object

delete_firmware_templateA

Delete a firmware template that is not assigned to any device or group.

An assigned template is refused, with the assignment listed: unassign it in the GUI first, so a delete can never change what firmware a device is held to without that being a deliberate step.

Verified on FortiManager 8.0.2; the template table is not in the bundled API reference.

Args: name: Template name adom: ADOM name (default: from DEFAULT_ADOM env var, or "root")

Returns: dict: status, message (and assigned_to when refused)

Inputs: name (required), adom. Returns: object

delete_ips_sensorA

Delete an IPS sensor.

WARNING: This will fail if the sensor is in use by policies.

Args: adom: ADOM name name: Sensor name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_local_in_policyB

Delete an IPv4 local-in policy.

WARNING: This operation cannot be undone.

Args: adom: ADOM name package: Policy package name policyid: Local-in policy ID to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), package (required), policyid (required). Returns: object

delete_local_in_policy6A

Delete an IPv6 local-in policy.

WARNING: This operation cannot be undone.

Args: adom: ADOM name package: Policy package name policyid: Local-in policy6 ID to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), package (required), policyid (required). Returns: object

delete_packageA

Delete a policy package.

WARNING: This will delete the package and all its policies. This operation cannot be undone.

Args: adom: ADOM name package: Package name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), package (required). Returns: object

delete_scriptB

Delete a CLI script.

Args: adom: ADOM name name: Script name to delete

Returns: Deletion result

Inputs: adom (required), name (required). Returns: object

delete_sdwan_templateB

Delete an SD-WAN template.

Note: Template must not be assigned to any devices before deletion.

Args: adom: ADOM name name: SD-WAN template name

Returns: Deletion result

Inputs: adom (required), name (required). Returns: object

delete_serviceA

Delete a service object.

WARNING: This will fail if the service is in use by policies.

Args: adom: ADOM name name: Service name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_service_groupA

Delete a service group.

WARNING: This will fail if the group is in use by policies.

Args: adom: ADOM name name: Group name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_ssl_ssh_profileA

Delete an SSL/SSH inspection profile.

WARNING: This will fail if the profile is in use by policies.

Args: adom: ADOM name name: Profile name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_taskA

Delete a task record from FortiManager's task list.

Deletes a completed task's record, or cancels/stops a still-running one (per the How-To guide: "Deleting a task could be used to delete a completed task or cancelling/stopping a running task."). Complements list_tasks/get_task/wait_for_task in system_tools.py.

Args: task_id: Task ID number

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await delete_task(11111)

Inputs: task_id (required). Returns: object

delete_waf_profileA

Delete a WAF profile.

WARNING: This will fail if the profile is in use by policies.

Args: adom: ADOM name name: Profile name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

delete_webfilter_profileB

Delete a web filter profile.

WARNING: This will fail if the profile is in use by firewall policies.

Args: adom: ADOM name name: Profile name to delete

Returns: dict: Delete result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required). Returns: object

diagnose_ipsec_tunnelA

Diagnose why an IPsec overlay tunnel is down, underlay first.

Gathers, in one call, what an engineer checks before comparing IPsec proposals: the underlay interface the gateway is bound to (admin status in the device DB, live link and address), the tunnel's live IKE/phase2 state, its SD-WAN member state and health-check results and, with hub_device, the hub's matching dial-up gateway (matched on network-id) and whether the hub holds an instance from this spoke. Read-only: config comes from the FMG device DB, live state from the device's monitor API through the FMG proxy.

The verdict follows the first failing layer: underlay_admin_down, underlay_link_down, underlay_no_address, hub_underlay_link_down, tunnel_down (underlay fine, IKE not up), health_check_down, sla_not_met, healthy, or undetermined when live state could not be read.

Args: device: Device the tunnel lives on (e.g. "branch2") tunnel: Phase1-interface name (e.g. "HUB1-VPN2") adom: ADOM of the device (default: DEFAULT_ADOM or "root") vdom: VDOM of the tunnel (default "root") hub_device: Optional hub device to check the far side on

Returns: dict: device, tunnel, verdict, explanation, next_steps, evidence (gateway, underlay, tunnel, health_checks, hub) and unverified (sources that could not be read)

Inputs: device (required), tunnel (required), adom, vdom, +1 more. Returns: object

diff_adom_revisionA

Diff a past ADOM DB revision against the CURRENT live ADOM.

Starts a FortiManager cache-diff job (the revision as source, the live ADOM as destination), polls it to completion, and returns the summary. Read-only -- nothing is written to the ADOM.

Args: adom: ADOM name revision: Revision number to compare against current (see list_adom_revisions) timeout: Maximum wait for the diff job in seconds (default 60, capped at 300) poll_interval: Seconds between poll attempts (default 2, capped at 30)

Returns: dict: status, adom, revision, obj (object-level change summary, keyed by category), pkg (per-package change summary)

Inputs: adom (required), revision (required), timeout, poll_interval. Returns: object

diff_device_revisionA

Diff a past device DB revision against the CURRENT device DB.

FortiManager has no native diff endpoint for device DB revisions (unlike ADOM DB revisions -- see diff_adom_revision). This instead fetches both the past revision's config text (checkout) and the current device DB export, then computes a client-side unified line diff. Read-only.

Note: The checkout half of this requires the device to have at least one device DB revision on record -- see the note on list_device_revisions.

Args: device: Managed device name revision: Revision number to compare against current (see list_device_revisions) sections: Only compare these config blocks, e.g. ["router bgp", "system interface"] (the leading "config " is optional). A block matches at any depth, so "router bgp" also finds it under a VDOM. A full diff can reach hundreds of KB, because a revision also lists default objects the current export omits.

Both sides are normalised before diffing: trailing whitespace, blank lines and # header lines (config-version, build number) are dropped, since the checkout and the current export differ in them without any configuration change.

Returns: dict: status, device, revision, changed (bool), diff (unified diff text, empty string if unchanged), and with sections also sections_missing (requested sections found on neither side). Both sides are redacted of known secret-bearing directives before diffing -- see redact_config_text_secrets -- so a line whose only change is its secret value will not show as changed.

Example: >>> result = await diff_device_revision("hub2", revision=7) >>> if result["changed"]: ... print(result["diff"])

Inputs: device (required), revision (required), sections. Returns: object

diff_policy_packageA

Diff a policy package's objects at a past ADOM revision against its CURRENT live state.

Package-level changes are tracked as part of the ADOM DB revision history, not separately, so this reuses the same cache-diff job as diff_adom_revision, scoped to one package's summary view. Read-only.

Args: adom: ADOM name package: Policy package name revision: ADOM revision number to compare against current (see list_adom_revisions) timeout: Maximum wait for the diff job in seconds (default 60, capped at 300) poll_interval: Seconds between poll attempts (default 2, capped at 30)

Returns: dict: status, adom, package, revision, summary (change summary for this package only, keyed by category -- e.g. 181 = firewall policy)

Inputs: adom (required), package (required), revision (required), timeout, +1 more. Returns: object

execute_script_on_deviceA

Execute a CLI script on a specific device.

The script must have target=remote_device to run directly on the device. Script execution creates a task that should be monitored for completion.

IMPORTANT: Keep the session alive while script executes on remote devices.

Args: adom: ADOM name script: Script name to execute device: Target device name

Returns: Task ID for monitoring execution progress

Inputs: adom (required), device (required), script (required). Returns: object

execute_script_on_device_groupA

Execute a CLI script on a device group.

Args: adom: ADOM name script: Script name to execute group: Device group name

Returns: Task ID for monitoring execution progress

Inputs: adom (required), group (required), script (required). Returns: object

execute_script_on_devicesB

Execute a CLI script on multiple devices.

Args: adom: ADOM name script: Script name to execute devices: List of device names

Returns: Task ID for monitoring execution progress

Inputs: adom (required), script (required), devices (required). Returns: object

execute_script_on_packageA

Execute a CLI script against a policy package or ADOM database.

The script must have target=adom_database. This modifies the package/ADOM DB, not a live device.

Args: adom: ADOM name script: Script name to execute package: Policy package name

Returns: Task ID for monitoring execution progress

Inputs: adom (required), script (required), package (required). Returns: object

find_duplicate_objectsA

Find objects with identical content configured under different names.

Runs FortiManager's "find duplicates" option against every object of the given type in the ADOM. FortiManager compares the requested fields across all objects of that type and adds a "duplicate entries" list to each object that shares its content with at least one other object -- the field itself, not something computed client-side.

Args: adom: ADOM name object_type: One of "address", "address_group", "service", "service_group" (default: "address") fields: Object fields to compare for duplication (e.g. ["name", "type", "subnet"] for addresses). Omit to let FortiManager use its default field set for the type.

Returns: dict: Duplicate scan result with keys: - status: "success" or "error" - object_type: The object type scanned - objects: Full per-object list FortiManager returned (each entry has a "duplicate entries" list when it has a match) - duplicate_count: Number of objects that have at least one duplicate entry - message: Error message if failed

Example: >>> result = await find_duplicate_objects("root", object_type="address") >>> for obj in result["objects"]: ... if obj.get("duplicate entries"): ... print(obj["name"], "duplicates:", obj["duplicate entries"])

Inputs: adom (required), fields, object_type. Returns: object

find_object_usageA

Find everywhere an ADOM object is referenced (where-used).

Runs FortiManager's cache-daemon where-used search: policies, groups, and other objects that reference the given object. This is a usage-graph lookup, distinct from object_tools.search_objects (which matches objects BY NAME, not by reference).

Args: adom: ADOM name (use "global" to search a Global ADOM object) object_name: Name of the object to trace usage for object_type: One of "address", "address_group", "service", "service_group" (default: "address") timeout: Maximum seconds to wait for the search to complete (default: 60, capped at 300) poll_interval: Seconds between progress checks (default: 2, clamped to 1-30)

Returns: dict: Usage result with keys: - status: "success" or "error" - object_name: The object searched for - object_type: The object type searched - total_matches: Number of referencing locations - used_in: List of where-used entries, each with the referencing object's root ADOM/package and the matching attr/mapping_name/mkey detail FortiManager returned - message: Error message if failed

Example: >>> result = await find_object_usage("root", "WebServer") >>> for entry in result["used_in"]: ... print(entry["root"], entry["data"])

Inputs: adom (required), object_name (required), timeout, object_type, +1 more. Returns: object

get_addressA

Get detailed information about a firewall address object.

Args: adom: ADOM name name: Address object name

Returns: dict: Address details with keys: - status: "success" or "error" - address: Full address configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_address_groupB

Get detailed information about an address group.

Args: adom: ADOM name name: Address group name

Returns: dict: Group details with keys: - status: "success" or "error" - group: Full group configuration including members - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_adomA

Get detailed information about a specific ADOM.

Args: name: ADOM name (e.g., "root", "customer-a") include_details: Include sub-objects (default: False)

Returns: dict: ADOM details with keys: - status: "success" or "error" - adom: ADOM object with full configuration - message: Error message if failed

Example: >>> result = await get_adom("root") >>> print(f"State: {result['adom']['state']}")

Inputs: name (required), include_details. Returns: object

get_adom_revisionA

Get one ADOM DB revision's metadata.

Args: adom: ADOM name revision: Revision number (the version field from list_adom_revisions)

Returns: dict: status, adom, revision (name, desc, created_by, created_time, locked, version)

Inputs: adom (required), revision (required). Returns: object

get_antivirus_profileB

Get detailed information about an antivirus profile.

Args: adom: ADOM name name: Antivirus profile name

Returns: dict: Profile details with keys: - status: "success" or "error" - profile: Full antivirus profile configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_application_listB

Get detailed information about an application-control list.

Args: adom: ADOM name name: Application-control list name

Returns: dict: List details with keys: - status: "success" or "error" - list: Full application-control list configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_bgp_templateA

Get the router bgp configuration inside a BGP provisioning template.

get_template returns only a template's metadata. This reads the BGP body a router_bgp template pushes -- AS, router-id, neighbors, neighbor-groups, neighbor-ranges and networks -- e.g. the templates an SD-WAN Overlay Template generates for its hub and branches. Values may be $(variable) placeholders resolved per device at install.

The template body path is not in the bundled FNDN specs; it is verified live on FortiManager 8.0.2 (see get_bgp_template_config in the client for the details and the 7.x fallback).

Args: adom: ADOM name name: BGP template name (list_templates entries whose template setting.stype is router_bgp)

Returns: dict with keys: - adom, name - bgp: raw router/bgp config object (neighbor password stripped -- see _BGP_SECRET_FIELDS) - summary: condensed AS/router-id/neighbors/networks - error / error_code: on failure

Inputs: adom (required), name (required). Returns: object

get_cli_templateA

Read a CLI template, with its script.

get_cli_template_group lists a group's members only; this returns what a member pushes. Secrets in the script are redacted, so the result shows that a template sets a password, not the value: set <secret> values and ENC blobs, SNMP community names, secret-named Jinja {% set %} assignments, and secret-keyed string literals inside Jinja tags. A bare variable reference (set psksecret {{ psk }}, $(psk)) is kept, since it names where the value comes from. Any other value is masked up to the next CLI line, and if a Jinja template could compute a secret from its own constants, those constants are masked too. A template whose type is "cli" is read as plain CLI; any other type as Jinja.

Args: adom: ADOM name name: CLI template name (see list_cli_templates)

Returns: dict: cli_template with name, type, description, variables, script

Inputs: adom (required), name (required). Returns: object

get_cli_template_groupA

Get details of a CLI template group.

Args: adom: ADOM name name: CLI template group name

Returns: CLI template group details

Inputs: adom (required), name (required). Returns: object

get_deviceA

Get detailed information about a specific managed device.

Args: name: Device name adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") include_details: Include sub-objects like VDOMs (default: False)

Returns: dict: Device details with keys: - status: "success" or "error" - device: Device object with full configuration - message: Error message if failed

Example: >>> result = await get_device("FGT-HQ", "root") >>> print(f"Version: {result['device']['os_ver']}") >>> print(f"Platform: {result['device']['platform_str']}")

Inputs: name (required), adom, include_details. Returns: object

get_device_bgpA

Get a managed device's BGP configuration from FortiManager's device DB.

Reads the router bgp config FortiManager holds for the device -- the result of any BGP template plus local settings, with variables resolved. This is configuration, not runtime state: it says which neighbors are configured, not whether they are established.

Args: device: Managed device name (e.g. "FGT-HQ") vdom: VDOM name (default: "root") summary_only: Leave out the raw bgp object, which lists some 150 fields per neighbor (default: False)

Returns: dict with keys: - device, vdom - bgp: raw router/bgp config object (neighbor password stripped -- see _BGP_SECRET_FIELDS), unless summary_only - summary: condensed AS/router-id/neighbors/networks - error / error_code: on failure

Inputs: device (required), vdom, summary_only. Returns: object

get_device_bgp_statusA

Read a device's LIVE BGP state through the FortiManager proxy.

Unlike get_device_bgp (which reads the device-DB BGP config), this proxies the device's monitor API to answer "are the peers established and which routes did they bring":

  • peer state (router/bgp/neighbors)

  • local and learned paths (router/bgp/paths)

  • BGP routes in the routing table (router/ipv4)

Dynamic peers from a neighbor-range are not configured neighbors: a hub lists none until a spoke connects, so an empty list there means no spoke is up, not that BGP is unconfigured. Check the spoke's state too.

Args: adom: ADOM name (defaults to DEFAULT_ADOM / "root" when omitted) device: Managed device name (e.g. "FGT-HQ"). Defaults to DEFAULT_DEVICE when omitted; required if that is not configured.

Returns: dict with keys: - adom, device - summary: neighbors with state, established_count, learned paths, BGP routes in the routing table - unverified: sources that could not be read - error / error_code: on failure

Inputs: adom, device. Returns: object

get_device_client_locationA

Locate a client on a device (Asset Identity Center): which FortiAP / FortiSwitch + VLAN it is connected through.

Proxies the device's detected-device inventory (/api/v2/monitor/user/device/query) -- the data behind the FortiManager "Asset Identity Center" view -- and answers "where is this client connected". Each match resolves to the access point / switch + port and VLAN the client is on, plus hostname, vendor/OS, online state, DHCP lease and vuln count.

Filter to one client by ip, mac or hostname (each provided filter narrows; a hostname match is case-insensitive substring). With no filter, the full detected-client inventory is returned (summarized).

Args: adom: ADOM name (defaults to DEFAULT_ADOM / "root" when omitted) device: Managed device name (e.g. "FGT-HQ"). Defaults to DEFAULT_DEVICE when omitted; required if that is not configured. ip: Client IPv4 address to locate (exact match) mac: Client MAC address to locate (case-insensitive) hostname: Client hostname to locate (case-insensitive substring)

Returns: dict with keys: - adom, device - query: the filter used (or None for full inventory) - match_count - clients: summarized detected-client records (ap/switch/port/vlan/...) - error / error_code: on failure

Inputs: ip, mac, adom, device, +1 more. Returns: object

get_device_interface_configA

Read a device's interface CONFIG objects from FortiManager's device DB.

Unlike get_device_interfaces (which proxies the live FortiGate monitor API and cannot filter by VLAN), this reads the interface configuration FortiManager keeps in its device database and supports server-side filtering by VLAN id and/or exact interface name. Use it to map a queried IP / client to the VLAN, interface and physical port it belongs to.

Args: device: Managed device name (e.g. "FGT-HQ"). Defaults to DEFAULT_DEVICE when omitted; required if that is not configured. vlanids: Optional list of VLAN ids to filter on (matches vlanid in) name: Optional exact interface name to filter on (e.g. "port1")

Returns: dict with keys: - device - interfaces: raw device-DB interface config (list or dict), credential fields stripped -- see _INTERFACE_SECRET_FIELDS - summary: condensed per-interface list (name/alias/vlanid/ip/...) - interface_count: number of summarized interfaces - error / error_code: on failure

Inputs: name, device, vlanids. Returns: object

get_device_interfacesA

Get interface information from a managed device.

Queries the actual device through FortiManager proxy to get current interface configuration and status.

Args: adom: ADOM name device: Device name

Returns: dict: Interface information with keys: - status: "success" or "error" - data: Interface list from FortiGate API - message: Error message if failed

Example: >>> result = await get_device_interfaces("root", "FGT-HQ") >>> for iface in result['data']: ... print(f"{iface['name']}: {iface.get('ip')}")

Inputs: adom (required), device (required). Returns: object

get_device_ipsec_phase1_interfaceA

Get one IPsec phase1-interface (remote gateway) from a device's device DB.

Args: device: Managed device name name: Phase1-interface (remote gateway) name vdom: VDOM it lives in (default "root")

Returns: dict with device, vdom and the stored object (credential fields stripped -- see _PHASE1_SECRET_FIELDS), or a not_found error

Inputs: name (required), device (required), vdom. Returns: object

get_device_ipsec_phase2_interfaceA

Get one IPsec phase2-interface (tunnel/selector) from a device's device DB.

Args: device: Managed device name name: Phase2-interface (tunnel) name vdom: VDOM it lives in (default "root")

Returns: dict with device, vdom and the stored object, or a not_found error

Inputs: name (required), device (required), vdom. Returns: object

get_device_realtime_statusA

Get real-time status from a managed device.

Queries the actual device through FortiManager proxy to get current system status including CPU, memory, and uptime.

Args: adom: ADOM name device: Device name

Returns: dict: Real-time status with keys: - status: "success" or "error" - data: Device status from FortiGate API - message: Error message if failed

Example: >>> result = await get_device_realtime_status("root", "FGT-HQ") >>> print(f"Uptime: {result['data'].get('uptime')}")

Inputs: adom (required), device (required). Returns: object

get_device_revisionA

Check out one device DB revision's stored configuration text.

Note: Requires the device to have at least one device DB revision on record -- see the note on list_device_revisions.

Args: device: Managed device name revision: Revision number (see list_device_revisions), or -1 (default) for the latest revision

Returns: dict: status, device, revision, content (device DB config text with known secret-bearing directives redacted -- see redact_config_text_secrets. Structured dict-field masking elsewhere in this codebase can't see inside this multi-line CLI text, so this applies a separate directive-name-based redaction.)

Example: >>> result = await get_device_revision("hub2", revision=8) >>> print(result["content"])

Inputs: device (required), revision. Returns: object

get_device_sdwanA

Get a managed device's SD-WAN configuration from FortiManager's device DB.

Unlike get_sdwan_template (which reads wanprof templates in an ADOM), this reads the SD-WAN config local to the device itself -- members/zones, health-checks and service (steering) rules -- from the device database FortiManager keeps in sync with the FortiGate. Use this when a device runs SD-WAN but has no wanprof template assigned (list_sdwan_templates returns nothing) yet you still need its members, zones and steering rules.

Args: device: Managed device name (e.g. "branch1") vdom: VDOM name (default: "root")

Returns: dict with keys: - device, vdom - sdwan: raw system/sdwan config object (health-check password stripped -- see _SDWAN_SECRET_FIELDS) - summary: condensed members/zones/health-checks/service rules - error / error_code: on failure

Inputs: device (required), vdom. Returns: object

get_device_sdwan_monitorA

Read a device's LIVE SD-WAN Monitor status through the FortiManager proxy.

Unlike get_device_sdwan (which reads the device-DB SD-WAN config), this proxies the device's live monitor API to return current SD-WAN runtime state -- the data the FortiManager "SD-WAN Monitor" view shows:

  • per-member link status and up/down bandwidth (virtual-wan/members)

  • per-member SLA health for each health-check: latency, jitter, packet loss and which SLA targets are met (virtual-wan/health-check)

Use it to answer "how are the uplinks doing right now / which member is breaching SLA", which the config read cannot answer.

Args: adom: ADOM name (defaults to DEFAULT_ADOM / "root" when omitted) device: Managed device name (e.g. "FGT-HQ"). Defaults to DEFAULT_DEVICE when omitted; required if that is not configured.

Returns: dict with keys: - adom, device - members: raw virtual-wan/members proxy response (None if it failed) - health_check: raw virtual-wan/health-check proxy response (None if it failed) - summary: condensed member links/bandwidth + per-member SLA - unverified: reads that failed while the other one worked; a failed read adds nothing to the summary - error / error_code: on failure, or when both reads failed

Inputs: adom, device. Returns: object

get_device_sslvpn_settingsA

Get the SSL-VPN (Agentless VPN) settings object from a device's device DB.

This is a per-vdom singleton -- there is exactly one, so no list/create/ delete tools exist for it, matching the FNDN schema's "object" (not "table") classification.

Args: device: Managed device name vdom: VDOM to read (default "root")

Returns: dict with device, vdom and the stored settings object

Inputs: device (required), vdom. Returns: object

get_device_sslvpn_web_portalA

Get an SSL-VPN web portal from a device's device DB.

Args: device: Managed device name name: Web portal name vdom: VDOM it lives in (default "root")

Returns: dict with device, vdom and the stored portal object (bookmark credentials stripped -- see _PORTAL_SECRET_FIELDS), or a not_found error

Inputs: name (required), device (required), vdom. Returns: object

get_device_static_routesA

Get a managed device's IPv4 static routes from FortiManager's device DB.

Complements get_device_bgp for a full routing picture: on an SD-WAN overlay the default route usually points at an SD-WAN zone and the overlay summaries are often blackholed here.

Args: device: Managed device name (e.g. "FGT-HQ") vdom: VDOM name (default: "root")

Returns: dict with keys: - device, vdom - routes: raw router/static entries - summary: condensed per-route list - route_count - error / error_code: on failure

Inputs: device (required), vdom. Returns: object

get_device_statusA

Get device status including connection and config sync status.

Returns status information for all devices or a specific device:

  • Connection status (up/down)

  • Config sync status (in_sync/out_of_sync)

  • DB status (modified/no_changes)

  • Device status (installed/checkedin/etc.)

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") device: Specific device name (optional, returns all if not specified)

Returns: dict: Device status with keys: - status: "success" or "error" - count: Number of devices - devices: List of device status objects - message: Error message if failed

Example: >>> # Get all device status >>> result = await get_device_status("root") >>> for dev in result['devices']: ... print(f"{dev['name']}: {dev['conn_status_str']}")

>>> # Get specific device status
>>> result = await get_device_status("root", "FGT-HQ")

Inputs: adom, device. Returns: object

get_device_wtpA

Get one managed FortiAP by wtp-id (serial number).

Args: device: Managed device name wtp_id: FortiAP serial number (the wtp-id / table mkey) vdom: VDOM the AP is registered in (default "root")

Returns: dict with device, vdom and the stored wtp object (credential fields stripped -- see _WTP_SECRET_FIELDS), or a not_found error if it does not exist

Inputs: device (required), wtp_id (required), vdom. Returns: object

get_device_wtp_profileA

Get a FortiAP (WTP) profile from a device's device DB, radios included.

Args: device: Managed device name profile: FortiAP (WTP) profile name vdom: VDOM the profile lives in (default "root")

Returns: dict with device, vdom and the stored profile object (credential fields stripped -- see _WTP_PROFILE_SECRET_FIELDS), or a not_found error if the profile does not exist

Inputs: device (required), profile (required), vdom. Returns: object

get_dlp_profileB

Get detailed information about a DLP profile.

Args: adom: ADOM name name: DLP profile name

Returns: dict: Profile details with keys: - status: "success" or "error" - profile: Full profile configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_dnsfilter_profileB

Get detailed information about a DNS filter profile.

Args: adom: ADOM name name: DNS filter profile name

Returns: dict: Profile details with keys: - status: "success" or "error" - profile: Full DNS filter profile configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_firewall_policyA

Get detailed information about a specific firewall policy.

Args: adom: ADOM name package: Policy package name policyid: Policy ID number

Returns: dict: Policy details with keys: - status: "success" or "error" - policy: Full policy configuration - message: Error message if failed

Example: >>> result = await get_firewall_policy("root", "default", 1) >>> print(f"Policy name: {result['policy']['name']}")

Inputs: adom (required), package (required), policyid (required). Returns: object

get_firmware_upgrade_pathA

Preview the multi-step firmware upgrade path to a target version.

Non-destructive: internally forces flags="f_preview" so FortiManager returns the intermediate versions it would step the device through without starting an upgrade. Some FortiOS upgrades cannot jump directly to the target release and must pass through intermediate builds first; this shows that path before you call upgrade_device_firmware.

Args: device: Managed device name target_version: Target firmware version, e.g. "7.2.9-b1688" adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") vdom: VDOM to scope the request to (optional)

Returns: dict: Upgrade path with keys: - status: "success" or "error" - upgrade_path: List of version strings FMG would step through - message: Error message if failed

Example: >>> result = await get_firmware_upgrade_path("FGT-HQ", "7.2.9-b1688") >>> print(result["upgrade_path"]) ['6.0.8-303', '6.2.4-1112', '7.2.9-1688']

Inputs: device (required), target_version (required), adom, vdom. Returns: object

get_firmware_upgrade_reportA

Get the firmware upgrade report for a device under a named profile.

Reports per-step upgrade results (health checks, package status, timestamps) for an upgrade run tracked under profile_name. The How-To Guide separately lists a "get upgrade history" question but marks it TBD with no confirmed distinct endpoint -- it speculates the same URL this wraps, so no separate history tool is provided; this is the one confirmed endpoint for both purposes.

profile_name must be a firmware upgrade profile FortiManager already knows about (e.g. one created through the GUI's Firmware Upgrade wizard, or the auto-created Firmware Template "key" a /um/image/upgrade/ext-style upgrade returns -- not something this module generates on its own).

Args: device: Managed device name profile_name: Firmware upgrade profile name to report on adom: ADOM name (default: from DEFAULT_ADOM env var, or "root")

Returns: dict: Upgrade report with keys: - status: "success" or "error" - report: Raw report data (nested per-device task/step details) - message: Error message if failed

Inputs: device (required), profile_name (required), adom. Returns: object

get_fmg_licenseA

Get the FortiManager license/contract status.

Returns the FortiManager's own license contract details (support entitlements, expiry dates, serial number) -- not managed-device licensing.

Returns: dict: License result with keys: - status: "success" or "error" - license: License data (contract list, count) - message: Error message if failed

Example: >>> result = await get_fmg_license() >>> print(result["license"]["contract"][0]["serial"])

Inputs: no named parameters. Returns: object

get_ha_statusA

Get FortiManager High Availability (HA) health.

Returns what FortiManager reports at /sys/ha/status. On a standalone unit that is the HA health alone, {"HA Health Status": "OK"} (measured on 7.6.8 and 8.0.2): no HA mode, no peer list and no primary/secondary role. The HA mode is in get_system_status, under "HA Mode".

Returns: dict: HA status with keys: - status: "success" or "error" - data: The HA status FortiManager returned - message: Error message if failed

Example: >>> result = await get_ha_status() >>> print(result["data"].get("HA Health Status"))

Inputs: no named parameters. Returns: object

get_ips_sensorB

Get detailed information about an IPS sensor.

Args: adom: ADOM name name: IPS sensor name

Returns: dict: Sensor details with keys: - status: "success" or "error" - sensor: Full sensor configuration, including its "entries" list of signature filters/overrides - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_local_in_policyB

Get detailed information about a specific IPv4 local-in policy.

Args: adom: ADOM name package: Policy package name policyid: Local-in policy ID number

Returns: dict: Policy details with keys: - status: "success" or "error" - policy: Full local-in policy configuration - message: Error message if failed

Example: >>> result = await get_local_in_policy("root", "default", 1)

Inputs: adom (required), package (required), policyid (required). Returns: object

get_local_in_policy6B

Get detailed information about a specific IPv6 local-in policy.

Args: adom: ADOM name package: Policy package name policyid: Local-in policy6 ID number

Returns: dict: Policy details with keys: - status: "success" or "error" - policy: Full local-in policy6 configuration - message: Error message if failed

Example: >>> result = await get_local_in_policy6("root", "default", 1)

Inputs: adom (required), package (required), policyid (required). Returns: object

get_packageA

Get detailed information about a policy package.

Args: name: Package name adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") include_details: Include policies and settings (default: False)

Returns: dict: Package details with keys: - status: "success" or "error" - package: Package object - message: Error message if failed

Inputs: name (required), adom, include_details. Returns: object

get_package_install_statusA

Show which policy package is assigned to each device and whether it is installed.

The same status the GUI shows per device in Policy & Objects: a package is "installed" when the device runs it, "modified" when the package changed since the last install, and "out of sync" when the device and FortiManager disagree. Use check_device_policy_sync to see which policies differ.

Args: adom: ADOM name device: Only this device (optional)

Returns: dict: status, count, packages: [{"device", "vdom", "package", "install_status"}]

Inputs: adom (required), device. Returns: object

get_packet_capture_statusA

Get the running/packet-count status of packet captures.

FortiManager reports capture progress for all definitions in one call; when capture_id is given this filters the response down to that one definition.

Args: capture_id: ID of a specific capture definition to filter to (optional; returns all captures' status if unset)

Returns: dict: Status result with keys: - status: "success" or "error" - count: Number of capture statuses returned - captures: List of {id, max_packets, packets, running} objects - message: Error message if failed

Example: >>> result = await get_packet_capture_status(capture_id=2) >>> print(result["captures"][0]["running"]) # 1 if still running

Inputs: capture_id. Returns: object

get_policy_servicesA

Get services configured on a firewall policy with optional group resolution.

Retrieves the service list from a firewall policy and optionally resolves each service/group into its detailed definition (ports, protocols, group members).

Useful for policy hardening workflows where you need to compare actual traffic against configured services.

Args: adom: ADOM name package: Policy package name policy_id: Policy ID number resolve: If True, resolve each service to its definition including port ranges and group members (default: True)

Returns: dict: Service information with keys: - status: "success" or "error" - policy_id: The policy ID queried - policy_name: Name of the policy - service_names: List of raw service names from the policy - services: Resolved service details (if resolve=True) - message: Error message if failed

Example: >>> # Get resolved services for policy 10 >>> result = await get_policy_services("root", "default", 10)

>>> # Get just the service names without resolution
>>> result = await get_policy_services("root", "default", 10, resolve=False)

Inputs: adom (required), package (required), policy_id (required), resolve. Returns: object

get_preview_resultA

Fetch the result of an installation preview.

On FortiManager 7.6.7+ / 8.0.2+ preview_install already returns its result and then discards the staged copy, so re-reading that preview here returns "=== No preview result ===" (measured on 8.0.2); this is for a preview staged elsewhere, e.g. the GUI install wizard. On older builds it is the second half of preview_install: call it once that preview's task has finished (wait_for_task).

Args: adom: ADOM name devices: Target devices [{"name": "FGT1", "vdom": "root"}, ...] preview_taskid: Staging task id of the preview (staging_task_id from preview_install; FMG 7.6.7+ / 8.0.2+ only). Omitted, FortiManager uses its last install task, which may not be the preview you mean. An id with no preview returns "=== No preview result ===".

Returns: dict: Preview results with keys: - status: "success" or "error" - preview: Preview data with configuration changes - message: Error message if failed

Inputs: adom (required), devices (required), preview_taskid. Returns: object

get_profile_groupB

Get a firewall security profile group.

Shows which profiles a policy using profile-group really applies: antivirus, IPS, application control, web filter, SSL inspection and so on.

Args: adom: ADOM name name: Profile group name

Returns: dict: status, profile_group, or message on failure

Inputs: adom (required), name (required). Returns: object

get_scriptA

Get details of a specific CLI script.

Args: adom: ADOM name name: Script name

Returns: Script details including content

Inputs: adom (required), name (required). Returns: object

get_script_log_latestB

Get the latest script execution log.

Args: adom: ADOM name device: Optional device name to filter logs

Returns: Latest script execution log with content and execution time, under "log". "log" is null when no script has run in that scope.

Inputs: adom (required), device. Returns: object

get_script_log_outputA

Get specific script execution output by log ID.

Log ID can be derived from task ID:

  • Scripts on Device DB or Package: log_id = str(task_id) + "1"

  • Scripts on remote device: log_id = str(task_id) + "0"

Args: adom: ADOM name log_id: Log ID from execution task or log summary device: Optional device name (required for device-specific logs)

Returns: Script execution output content

Inputs: adom (required), log_id (required), device. Returns: object

get_script_log_summaryA

Get script execution log summary.

Lists all script executions with log IDs for detailed retrieval.

Args: adom: ADOM name device: Optional device name to filter logs

Returns: List of script execution summaries with log_id, script_name, exec_time

Inputs: adom (required), device. Returns: object

get_sdwan_templateA

Get details of a specific SD-WAN template.

Args: adom: ADOM name name: SD-WAN template name

Returns: SD-WAN template details including interfaces, SLAs, and rules

Inputs: adom (required), name (required). Returns: object

get_sdwan_template_configA

Get the SD-WAN configuration inside a wanprof (SD-WAN) template.

get_sdwan_template returns only the template's metadata (name, type, scope). This reads the configuration the template pushes -- members, zones, health-checks with their SLA thresholds, and service (steering) rules -- from the template's own config subtree.

Args: adom: ADOM name name: SD-WAN template name (as listed by list_sdwan_templates)

Returns: dict with keys: - adom, name - sdwan: raw system/sdwan config object (health-check password stripped -- see _SDWAN_SECRET_FIELDS) - summary: condensed members/zones/health-checks/service rules - error / error_code: on failure

Inputs: adom (required), name (required). Returns: object

get_serviceC

Get detailed information about a service object.

Args: adom: ADOM name name: Service object name

Returns: dict: Service details with keys: - status: "success" or "error" - service: Full service configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_service_groupA

Get detailed information about a service group.

Args: adom: ADOM name name: Service group name

Returns: dict: Group details with keys: - status: "success" or "error" - group: Full group configuration including members - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_ssl_ssh_profileA

Get detailed information about an SSL/SSH inspection profile.

Args: adom: ADOM name name: SSL/SSH profile name

Returns: dict: Profile details with keys: - status: "success" or "error" - profile: Full profile configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_system_statusA

Get FortiManager system status and version information.

Returns comprehensive system status including:

  • FortiManager version and build

  • System hostname

  • Serial number

  • Admin domain mode

  • Platform information

  • HA status

Returns: dict: System status with keys: - status: "success" or "error" - data: System status information - message: Error message if failed

Example: >>> result = await get_system_status() >>> print(f"Version: {result['data']['Version']}") >>> print(f"Hostname: {result['data']['Hostname']}")

Inputs: no named parameters. Returns: object

get_system_templateB

Get details of a specific system template.

Args: adom: ADOM name name: System template name

Returns: System template details including widgets and assigned devices

Inputs: adom (required), name (required). Returns: object

get_taskA

Get detailed status of a specific task.

Args: task_id: Task ID number include_details: Include task line details (default: False)

Returns: dict: Task details with keys: - status: "success" or "error" - task: Task object with id, state, progress, result, etc. - lines: Task line details (if include_details=True) - message: Error message if failed

Example: >>> result = await get_task(12345) >>> print(f"State: {result['task']['state']}") >>> print(f"Progress: {result['task'].get('percent', 0)}%")

Inputs: task_id (required), include_details. Returns: object

get_templateB

Get details of a specific provisioning template.

Args: adom: ADOM name name: Template name

Returns: Template details including settings and scope

Inputs: adom (required), name (required). Returns: object

get_template_groupB

Get details of a template group.

Args: adom: ADOM name name: Template group name

Returns: Template group details including member templates

Inputs: adom (required), name (required). Returns: object

get_waf_profileB

Get detailed information about a WAF profile.

Args: adom: ADOM name name: WAF profile name

Returns: dict: Profile details with keys: - status: "success" or "error" - profile: Full profile configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

get_webfilter_profileB

Get detailed information about a web filter profile.

Args: adom: ADOM name name: Web filter profile name

Returns: dict: Profile details with keys: - status: "success" or "error" - profile: Full web filter profile configuration - message: Error message if failed

Inputs: adom (required), name (required). Returns: object

health_checkA

Check FortiManager MCP server health and connection status.

Inputs: no named parameters. Returns: result

install_device_settingsA

Install device settings only (without policy package).

Deploys device-level configurations like interfaces, DNS, NTP without reinstalling the full policy package.

By default (FMG_INSTALL_SAFETY=strict) this requires a verified preview first, like install_package: run preview_install with package=None for the same ADOM and devices and review its result (on FortiManager builds older than 7.6.7 / 8.0.2, preview_install returns a task: wait_for_task on it and read get_preview_result). Each preview authorizes one install. A package preview does not authorize this install, nor the reverse.

Args: adom: ADOM name devices: Target devices [{"name": "FGT1", "vdom": "root"}, ...] dev_rev_comments: Optional comment for the device revision the install creates (shown in Revision History, max 127 bytes)

Returns: dict: Installation result with keys: - status: "success" or "error" - task_id: Task ID for monitoring - message: Status or error message - warning: Set when FMG_INSTALL_SAFETY=warn let an install without a verified preview through Refused by the gate: status "error", error "preview_required", recommendation "preview_install".

Inputs: adom (required), devices (required), dev_rev_comments. Returns: object

install_packageA

Install a policy package to managed devices.

Deploys firewall policies and configurations from a policy package to the specified devices. This is an asynchronous operation - use wait_for_task() to monitor completion.

By default (FMG_INSTALL_SAFETY=strict) a real install requires a verified preview first: run preview_install for the same ADOM, package, and devices and review its result (on FortiManager builds older than 7.6.7 / 8.0.2, preview_install returns a task: wait_for_task on it and read get_preview_result). Each preview authorizes one install, and only while the package is unchanged — if the package was edited after the preview, the install is refused (preview_stale) and a fresh preview is required. A preview that found nothing to install authorizes nothing.

Args: adom: ADOM name package: Policy package name devices: Target devices [{"name": "FGT1", "vdom": "root"}, ...] preview: If True, run preview_install instead: nothing is installed (default: False). Changed in 1.13.0: this used to stage the install and return at once, leaving the devices held by an install-wizard session; it now runs the same full preview as preview_install, returns its result, and like it authorizes one install of the same target.

Returns: dict: Installation result with keys: - status: "success" or "error" - task_id: Task ID for monitoring (if successful) - message: Status or error message With preview=True: the preview_install response plus preview: True.

Example: >>> # Install to single device >>> result = await install_package( ... adom="root", ... package="default", ... devices=[{"name": "FGT-HQ", "vdom": "root"}] ... ) >>> if result["status"] == "success": ... await wait_for_task(result["task_id"])

>>> # Preview installation first
>>> result = await install_package(
...     adom="root",
...     package="default",
...     devices=[{"name": "FGT-HQ", "vdom": "root"}],
...     preview=True
... )

Inputs: adom (required), devices (required), package (required), preview. Returns: object

list_addressesA

List firewall address objects in an ADOM.

Address objects define network entities (hosts, subnets, FQDNs) used in firewall policies.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match) type_filter: Filter by type ("ipmask", "fqdn", "iprange", "wildcard")

Returns: dict: Address list with keys: - status: "success" or "error" - count: Number of addresses - addresses: List of address objects - message: Error message if failed

Example: >>> # List all addresses >>> result = await list_addresses("root")

>>> # Find FQDN addresses
>>> result = await list_addresses("root", type_filter="fqdn")

Inputs: adom, name_filter, type_filter. Returns: object

list_address_groupsA

List firewall address groups in an ADOM.

Address groups contain multiple address objects for easier policy management.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Group list with keys: - status: "success" or "error" - count: Number of groups - groups: List of address group objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_adom_revisionsB

List the ADOM DB revision history for an ADOM.

Args: adom: ADOM name fields: Specific fields to return (optional, returns all if omitted)

Returns: dict: status, adom, count, revisions (each entry has version, name, desc, created_by, created_time, locked)

Example: >>> result = await list_adom_revisions("demo") >>> for rev in result["revisions"]: ... print(rev["version"], rev["desc"])

Inputs: adom (required), fields. Returns: object

list_adomsA

List all Administrative Domains (ADOMs) in FortiManager.

ADOMs partition FortiManager into separate management domains, each with its own devices, policies, and configurations.

Args: fields: Specific fields to return (optional, returns all if not specified)

Returns: dict: ADOM list with keys: - status: "success" or "error" - count: Number of ADOMs - adoms: List of ADOM objects with name, desc, state, etc. - message: Error message if failed

Example: >>> result = await list_adoms() >>> for adom in result["adoms"]: ... print(f"{adom['name']}: {adom.get('desc', 'No description')}")

Inputs: fields. Returns: object

list_antivirus_profilesA

List antivirus profiles in an ADOM.

Antivirus profiles define virus/malware scanning behavior per protocol (HTTP, FTP, SMTP, etc.) and are applied to firewall policies.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Profile list with keys: - status: "success" or "error" - count: Number of profiles - profiles: List of antivirus profile objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_application_listsA

List application-control lists in an ADOM.

Application control lists define pass/block/monitor actions for application signatures and categories, applied to firewall policies.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: List result with keys: - status: "success" or "error" - count: Number of application-control lists - lists: List of application-control list objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_available_firmwareA

List firmware versions available for a platform.

Combines versions on FortiGuard (FDS) servers with any versions imported by a FortiManager administrator -- this is the device-reported catalog of what CAN be installed, not just what's already downloaded (see list_firmware_images for that).

Args: platform: Platform string, e.g. "FortiGate-VM64-KVM" (omit to get firmware for all platforms) product: Product code, e.g. "FGT", "FMG" (optional)

Returns: dict: Firmware catalog with keys: - status: "success" or "error" - version_list: List of {platform, product, versions: [...]} - message: Error message if failed

Example: >>> result = await list_available_firmware(platform="FortiGate-VM64-KVM") >>> for entry in result["version_list"]: ... print(entry["platform"], len(entry["versions"]))

Inputs: product, platform. Returns: object

list_cli_template_groupsB

List CLI template groups in an ADOM.

CLI template groups contain CLI commands to be executed on devices.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") limit: Maximum number to return (default: 100, minimum: 1)

Returns: List of CLI template groups. count is the number returned and total the number before limit: if total is larger the list was cut, raise limit for the rest.

Inputs: adom, limit. Returns: object

list_cli_templatesB

List CLI templates in an ADOM, without their scripts.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") limit: Maximum number to return (default: 100, minimum: 1)

Returns: dict: adom, count, total, cli_templates (name, type, description, variables). count is the number returned and total the number before limit: if total is larger the list was cut, raise limit for the rest.

Inputs: adom, limit. Returns: object

list_device_dhcp_serversA

List DHCP servers configured in a device's device DB.

Args: device: Managed device name vdom: VDOM to read (default "root")

Returns: dict with device, vdom, count and dhcp_servers (raw device-DB objects, keyed by numeric id)

Inputs: device (required), vdom. Returns: object

list_device_groupsA

List all device groups in an ADOM.

Device groups organize managed devices for bulk operations like policy installation or configuration deployment.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root")

Returns: dict: Device groups with keys: - status: "success" or "error" - count: Number of groups - groups: List of device group objects - message: Error message if failed

Inputs: adom. Returns: object

list_device_ipsec_phase1_interfacesA

List IPsec phase1-interface (remote gateway) definitions in a device's device DB.

Args: device: Managed device name vdom: VDOM to read (default "root")

Returns: dict with device, vdom, count and interfaces (credential fields stripped -- see _PHASE1_SECRET_FIELDS)

Inputs: device (required), vdom. Returns: object

list_device_ipsec_phase2_interfacesA

List IPsec phase2-interface (tunnel/selector) definitions in a device's device DB.

Args: device: Managed device name vdom: VDOM to read (default "root")

Returns: dict with device, vdom, count and interfaces

Inputs: device (required), vdom. Returns: object

list_device_revisionsA

List the device DB revision history for a managed device.

Every install, auto-update, retrieve, or revert creates a new device DB revision. base_ver is the revision FortiManager currently considers in sync with the real device configuration.

Note: Requires the device to have at least one device DB revision on record (i.e. it has been installed to or retrieved from at least once). A freshly added device that has never gone through either will make FortiManager return a generic internal-server error here rather than an empty list -- that is FMG's own handling of an empty revision table, not a sign this tool or the underlying API is broken.

Args: device: Managed device name

Returns: dict: status, device, base_ver, count, revisions (each entry has revision, comments, instime/instusr, modtime/modusr, status, tag)

Example: >>> result = await list_device_revisions("hub2") >>> for rev in result["revisions"]: ... print(rev["revision"], rev["comments"])

Inputs: device (required). Returns: object

list_devicesA

List all managed devices in an ADOM.

FortiManager manages FortiGate and other Fortinet devices. This lists all devices registered in the specified ADOM.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") fields: Specific fields to return (optional)

Returns: dict: Device list with keys: - status: "success" or "error" - count: Number of devices - devices: List of device objects with name, ip, os_ver, etc. - message: Error message if failed

Example: >>> result = await list_devices("root") >>> for device in result["devices"]: ... print(f"{device['name']}: {device.get('ip', 'N/A')}")

Inputs: adom, fields. Returns: object

list_device_vapsB

List wireless VAPs (SSIDs) in a device's device DB.

Args: device: Managed device name vdom: VDOM to read (default "root")

Returns: dict with device, vdom, count and vaps (passphrases stripped)

Inputs: device (required), vdom. Returns: object

list_device_vdomsA

List VDOMs for a specific device.

Virtual Domains (VDOMs) are independent virtual instances within a FortiGate device, each with its own configuration.

Args: device: Device name adom: ADOM name (default: from DEFAULT_ADOM env var, or "root")

Returns: dict: VDOM list with keys: - status: "success" or "error" - count: Number of VDOMs - vdoms: List of VDOM objects with name, status, etc. - message: Error message if failed

Example: >>> result = await list_device_vdoms("FGT-HQ", "root") >>> for vdom in result['vdoms']: ... print(f"VDOM: {vdom['name']}")

Inputs: device (required), adom. Returns: object

list_device_wtp_profilesB

List FortiAP (WTP) profiles in a device's device DB.

Args: device: Managed device name vdom: VDOM to read (default "root")

Returns: dict with device, vdom, count and profiles (credential fields stripped -- see _WTP_PROFILE_SECRET_FIELDS)

Inputs: device (required), vdom. Returns: object

list_device_wtpsA

List managed FortiAPs registered in a device's device DB.

Args: device: Managed device name (the wireless controller / FortiGate) vdom: VDOM to read (default "root")

Returns: dict with device, vdom, count and wtps (device-DB objects keyed by wtp-id/serial, credential fields stripped -- see _WTP_SECRET_FIELDS)

Inputs: device (required), vdom. Returns: object

list_dlp_profilesA

List DLP (Data Loss Prevention) profiles in an ADOM.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Profile list with keys: - status: "success" or "error" - count: Number of profiles - profiles: List of DLP profile objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_dnsfilter_profilesB

List DNS filter profiles in an ADOM.

DNS filter profiles control FortiGuard DNS category rating actions, botnet C&C domain blocking, and DNS-level safe search.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Profile list with keys: - status: "success" or "error" - count: Number of profiles - profiles: List of DNS filter profile objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_firewall_policiesA

List firewall policies in a policy package.

Args: adom: ADOM name package: Policy package name fields: Specific fields to return (optional) limit: Maximum number of policies to return (optional) offset: Starting position for pagination (default: 0)

Returns: dict: Policy list with keys: - status: "success" or "error" - count: Number of policies returned - total: Total number of policies in package - policies: List of policy objects - message: Error message if failed

Example: >>> # Get all policies >>> result = await list_firewall_policies("root", "default")

>>> # Get first 10 policies with specific fields
>>> result = await list_firewall_policies(
...     adom="root",
...     package="default",
...     fields=["policyid", "name", "srcaddr", "dstaddr", "action"],
...     limit=10
... )

Inputs: adom (required), package (required), limit, fields, +1 more. Returns: object

list_firmware_imagesA

List firmware image files stored on the FortiManager's local disk.

These are the files already imported by an administrator and/or downloaded from FortiGuard -- a subset of what list_available_firmware reports, scoped to what FortiManager could push without first fetching it from FortiGuard.

Args: system: Product code to filter by, e.g. "FMG", "FGT" (optional; FortiManager returns every stored image when omitted or when there's no match for the given code)

Returns: dict: Local image list with keys: - status: "success" or "error" - image_list: List of {platform, product, version, build, date, image_path, image_size} - message: Error message if failed

Inputs: system. Returns: object

list_firmware_templatesA

List firmware templates: enforced versions, schedule and assignment.

Verified on FortiManager 8.0.2; the template table is not in the bundled API reference, so other versions may refuse it (reported as firmware_templates_unavailable).

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root")

Returns: dict: status, count, templates: [{name, description, image_source, schedule {type, start_time, end_time, days}, versions [{platform, product, version, upgrade_path}], assigned_to [device or group names]}]

Inputs: adom. Returns: object

list_ips_sensorsA

List IPS sensors in an ADOM.

IPS sensors are collections of intrusion-prevention signature filters and overrides, referenced by firewall policies for the "IPS" security profile.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Sensor list with keys: - status: "success" or "error" - count: Number of sensors - sensors: List of IPS sensor objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_ips_sensor_signature_overridesA

List the signature-filter/override entries of an IPS sensor.

Each entry is either a broad filter (matched by severity/protocol/OS/...) or a specific signature override (matched by an explicit "rule" list of signature names). Use the returned "id" values with remove_ips_sensor_signature_override.

Args: adom: ADOM name sensor: IPS sensor name

Returns: dict: Entry list with keys: - status: "success" or "error" - count: Number of entries - entries: List of entry objects - message: Error message if failed

Inputs: adom (required), sensor (required). Returns: object

list_local_in_policiesA

List IPv4 local-in policies in a policy package.

Local-in policies control access to the FortiGate's own management plane (GUI, SSH, ping, API, SNMP, etc.), not through-traffic.

Args: adom: ADOM name package: Policy package name fields: Specific fields to return (optional) limit: Maximum number of policies to return (optional) offset: Starting position for pagination (default: 0)

Returns: dict: Policy list with keys: - status: "success" or "error" - count: Number of policies returned - total: Total number of local-in policies in package - policies: List of local-in policy objects - message: Error message if failed

Example: >>> result = await list_local_in_policies("root", "default")

Inputs: adom (required), package (required), limit, fields, +1 more. Returns: object

list_local_in_policies6A

List IPv6 local-in policies in a policy package.

Local-in policies control access to the FortiGate's own management plane (GUI, SSH, ping, API, SNMP, etc.) over IPv6, not through-traffic.

Args: adom: ADOM name package: Policy package name fields: Specific fields to return (optional) limit: Maximum number of policies to return (optional) offset: Starting position for pagination (default: 0)

Returns: dict: Policy list with keys: - status: "success" or "error" - count: Number of policies returned - total: Total number of local-in policies6 in package - policies: List of local-in policy6 objects - message: Error message if failed

Example: >>> result = await list_local_in_policies6("root", "default")

Inputs: adom (required), package (required), limit, fields, +1 more. Returns: object

list_metadata_variablesA

List an ADOM's metadata variables and their per-device values.

Metadata variables are what templates reference as $(name); a model device import (add_model_device with meta_variables) stores its values as per-device mappings. Password-type values are redacted.

Args: adom: ADOM name device: Optional device name; when given, device_values holds every variable's value for that device and where it comes from ("device" mapping or ADOM "default"). A device mapping lists each of its scopes in scopes; value is None when they differ.

Returns: dict: status, count, variables (name, type, description, default, mappings[{device, vdom, value}]) and, with device, device_values

Inputs: adom (required), device. Returns: object

list_packagesA

List all policy packages in an ADOM.

Policy packages contain firewall policies, security profiles, and other configurations to be installed on managed devices.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root")

Returns: dict: Package list with keys: - status: "success" or "error" - count: Number of packages - packages: List of package objects - message: Error message if failed

Example: >>> result = await list_packages("root") >>> for pkg in result["packages"]: ... print(f"{pkg['name']}: {pkg.get('type', 'policy')}")

Inputs: adom. Returns: object

list_packet_capturesA

List existing FortiManager packet capture definitions.

Returns the packet capture (sniffer) definitions configured on the FortiManager itself, for traffic originating or destined to the FMG. These are configuration records, not live capture results -- use get_packet_capture_status() for running/packet-count state.

Returns: dict: Capture list with keys: - status: "success" or "error" - count: Number of capture definitions - captures: List of capture objects (id, interface, host, port, protocol, vlan, ipv6, non-ip, max-packet-count) - message: Error message if failed

Example: >>> result = await list_packet_captures() >>> for cap in result["captures"]: ... print(f"{cap['id']}: {cap['interface']}")

Inputs: no named parameters. Returns: object

list_policy_block_policiesA

List the firewall policies held in a policy block.

Args: adom: ADOM name block: Policy block name (see list_policy_blocks, or the _policy_block field of a package entry). A block that does not exist answers "No permission for the resource" (FMG -11), not "not found" (measured on 8.0.2) fields: Specific fields to return (optional) limit: Maximum number of policies to return (optional) offset: Starting position for pagination (default: 0)

Returns: dict: status, count, policies, or message on failure

Inputs: adom (required), block (required), limit, fields, +1 more. Returns: object

list_policy_blocksA

List the policy blocks of an ADOM.

A policy block is a reusable set of policies. A package shows it as a single entry with _policy_block and empty fields; read its policies with list_policy_block_policies.

Args: adom: ADOM name

Returns: dict: status, count, blocks, or message on failure

Inputs: adom (required). Returns: object

list_policy_revisionsA

List the change log for a policy package's firewall policies.

Args: adom: ADOM name package: Policy package name policyid: Limit to one policy's change history (optional; all policies in the package if omitted)

Returns: dict: status, adom, package, policyid, count, changes -- each entry has act (1=created, 2=deleted, 3=modified), key (the policyid), config (a JSON-encoded policy snapshot at that change -- pass straight to revert_firewall_policy), timestamp, user

Example: >>> result = await list_policy_revisions("demo", "ppkg_001", policyid=14) >>> first_change = result["changes"][0] >>> await revert_firewall_policy("demo", "ppkg_001", first_change["config"])

Inputs: adom (required), package (required), policyid. Returns: object

list_scriptsA

List CLI scripts in an ADOM.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") script_type: Filter by type (cli, tcl, cligrp, tclgrp, jinja) target: Filter by target (device_database, remote_device, adom_database) limit: Maximum number of scripts to return (default: 100, minimum: 1)

Returns: List of scripts with name, type, target, and description. count is the number returned and total the number before limit: if total is larger the list was cut, raise limit for the rest.

Inputs: adom, limit, target, script_type. Returns: object

list_sdwan_templatesA

List SD-WAN templates in an ADOM.

SD-WAN templates define WAN interface configurations, performance SLAs, and traffic steering rules for SD-WAN deployments.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") limit: Maximum number of templates to return (default: 100, minimum: 1)

Returns: List of SD-WAN templates with name, type, and assigned devices. count is the number returned and total the number before limit: if total is larger the list was cut, raise limit for the rest.

Inputs: adom, limit. Returns: object

list_service_groupsA

List service groups in an ADOM.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Group list with keys: - status: "success" or "error" - count: Number of groups - groups: List of service group objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_servicesA

List custom service objects in an ADOM.

Service objects define network protocols and ports used in policies.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match) protocol_filter: Filter by protocol ("TCP/UDP/SCTP", "ICMP", "IP")

Returns: dict: Service list with keys: - status: "success" or "error" - count: Number of services - services: List of service objects - message: Error message if failed

Inputs: adom, name_filter, protocol_filter. Returns: object

list_ssl_ssh_profilesA

List SSL/SSH inspection profiles in an ADOM.

SSL/SSH inspection profiles control how a FortiGate decrypts and inspects TLS/SSH traffic, referenced by firewall policies for the "SSL/SSH Inspection" security profile.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Profile list with keys: - status: "success" or "error" - count: Number of profiles - profiles: List of SSL/SSH profile objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_system_templatesA

List system templates (device profiles) in an ADOM.

System templates configure device settings like DNS, NTP, logging, etc.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") limit: Maximum number to return (default: 100, minimum: 1)

Returns: List of system templates with name, type, and assigned devices. count is the number returned and total the number before limit: if total is larger the list was cut, raise limit for the rest.

Inputs: adom, limit. Returns: object

list_tasksA

List FortiManager tasks, newest first.

Tasks represent background operations like policy installation, device provisioning, and other long-running processes.

Changed in 1.13.0: returns the newest limit tasks (default 100; total says how many matched) and drops each task's line list unless include_lines is set. It used to return every task with its lines, which can reach hundreds of KB per call. Raise limit or narrow with since_hours to see further back.

Args: filter_state: Filter by task state (optional): - "pending": Not started - "running": Currently executing - "done": Completed - "error": Failed - "cancelling": Being cancelled - "cancelled": Cancelled limit: Maximum number of tasks to return (default: 100) since_hours: Only tasks started in the last N hours (optional) include_lines: Include each task's per-device lines and history (default: False, they can reach hundreds of KB; get_task reads them for one task)

Returns: dict: Task list with keys: - status: "success" or "error" - count: Number of tasks returned - total: Number of tasks matching before limit - tasks: List of task objects with id, state, progress, etc. - message: Error message if failed

Example: >>> # Get all tasks >>> result = await list_tasks()

>>> # Get only running tasks
>>> result = await list_tasks(filter_state="running")

Inputs: limit, since_hours, filter_state, include_lines. Returns: object

list_template_groupsA

List template groups in an ADOM.

Template groups combine multiple templates (system, CLI, SD-WAN, etc.) into a single package for device assignment.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") limit: Maximum number to return (default: 100, minimum: 1)

Returns: List of template groups. count is the number returned and total the number before limit: if total is larger the list was cut, raise limit for the rest.

Inputs: adom, limit. Returns: object

list_templatesA

List all provisioning templates in an ADOM.

Returns all template types: IPsec, BGP, system, etc.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") limit: Maximum number of templates to return (default: 100, minimum: 1)

Returns: List of templates with name, type, and settings. count is the number returned and total the number before limit: if total is larger the list was cut, raise limit for the rest.

Inputs: adom, limit. Returns: object

list_waf_profilesA

List WAF (Web Application Firewall) profiles in an ADOM.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Profile list with keys: - status: "success" or "error" - count: Number of profiles - profiles: List of WAF profile objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

list_webfilter_profilesA

List web filter profiles in an ADOM.

Web filter profiles define URL category rating actions, FortiGuard web filtering behavior, and related web-content controls.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by name (partial match)

Returns: dict: Profile list with keys: - status: "success" or "error" - count: Number of profiles - profiles: List of web filter profile objects - message: Error message if failed

Inputs: adom, name_filter. Returns: object

lock_adomA

Lock an ADOM for editing (workspace mode).

In workspace mode, ADOMs must be locked before making changes. This prevents conflicts from multiple administrators editing the same ADOM simultaneously.

Args: adom: ADOM name to lock

Returns: dict: Lock result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await lock_adom("root") >>> if result["status"] == "success": ... # Make changes... ... await commit_adom("root") ... await unlock_adom("root")

Inputs: adom (required). Returns: object

move_firewall_policyA

Move a firewall policy to a new position.

Reorders a policy relative to another policy in the rule list. Policy order determines evaluation priority.

Args: adom: ADOM name package: Policy package name policyid: Policy ID to move target_policyid: Reference policy ID position: Where to place - "before" or "after" (default: "before")

Returns: dict: Move result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> # Move policy 10 before policy 5 >>> result = await move_firewall_policy( ... adom="root", ... package="default", ... policyid=10, ... target_policyid=5, ... position="before" ... )

Inputs: adom (required), package (required), policyid (required), target_policyid (required), +1 more. Returns: object

policy_lookupA

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"). Pass it: the How-To Guide example sends it, and FortiOS 7.6.7 answers a lookup without it with HTTP 424 and one with any (not an interface) with HTTP 400, both returned as device_proxy_error. Omitted from the query when not given. 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

Inputs: adom (required), dest (required), device (required), protocol (required), +5 more. Returns: object

preview_installA

Preview what installing a policy package (or device settings) would push.

On FortiManager 7.6.7+ and 8.0.2+ this runs the full Install Preview and returns its result in one call: it stages the install (nothing reaches the device), renders the CLI it would push, then releases the staged copy. Staging is also where an uninstallable package fails -- e.g. a normalized interface with no mapping for a device -- so a failed preview returns the FortiManager task lines explaining why.

Changed in 1.13.0: the call now blocks until the preview is finished (up to timeout, default 300 s) and returns the per-device CLI directly; it used to return a task id at once, to be followed by wait_for_task and get_preview_result. On older builds (7.0-7.6.6, 8.0.0-8.0.1) it still works that way, with a warning: those builds cannot tie the preview to the named package without risking another administrator's install wizard (see utils/install_preview.py).

A successful package preview also authorizes one install_package of the same ADOM/package/devices (FMG_INSTALL_SAFETY gate); with package=None it authorizes one install_device_settings of the same ADOM/devices instead. A preview that finds nothing to install does not: there is nothing to push. Starting a preview drops any earlier preview of the same target, so only the latest attempt can authorize.

Args: adom: ADOM name package: Policy package name, or None to preview pending device settings (what install_device_settings would push) devices: Target devices [{"name": "FGT1", "vdom": "root"}, ...] timeout: Wall-clock budget in seconds for the whole preview (default 300, min 30, max 900)

Returns: dict: status; staged (whether the full preview ran); task_id (the render task); staging_task_id; devices: [{"name", "has_changes", "preview"}] where preview is the FortiOS CLI the install would send (credentials redacted); message. task_lines when FortiManager found nothing to install. warning when the staged copy could not be released (the devices may stay held; it says how to release them) or on an older build. On a failed step: status "error", error "preview_failed", step, task_lines with FortiManager's reason, and release_warning if the release failed too.

Example: >>> result = await preview_install( ... adom="root", ... package="default", ... devices=[{"name": "FGT-HQ", "vdom": "root"}], ... ) >>> for dev in result["devices"]: ... print(dev["name"], dev["preview"])

Inputs: adom (required), devices (required), package (required), timeout. Returns: object

query_device_apiA

Read a diagnostic FortiOS REST API path on a managed device through FortiManager.

Proxies a GET through /sys/proxy/json, so the device needs no direct route or credentials. Use it for what no dedicated tool covers: live state from monitor paths, the running configuration from cmdb paths.

Read-only: only GET is sent, and only to an allowlist of paths (each with everything below it): monitor system status/resource/interface/ ha-peer/dhcp/link-monitor, router (ipv4, lookup, bgp, ospf, ...), network arp/lldp, firewall session/policy hit counts, vpn ipsec/ssl, virtual-wan, switch-controller managed-switch/status and detected-device, wifi clients and APs, user device/firewall; cmdb firewall, router, system interface/zone/sdwan/ ha/global/dns/snmp, vpn.ipsec, switch-controller, wireless-controller, user group and the security profiles. Anything else, and every file export or dump, is refused with the full list. Secrets are redacted by field name and value, SNMP community strings included, and params accepts the listed query parameters only.

Args: path: API path without query string, e.g. /api/v2/monitor/router/ipv4 or /api/v2/cmdb/firewall/address device: Managed device name. Defaults to DEFAULT_DEVICE when omitted. adom: ADOM name (default: DEFAULT_ADOM or "root") vdom: VDOM to query (default: the device's own default) params: Query parameters, from: count, datasource, destination, exclude-default-values, filter, format, include_vlan, ip_version, key, pattern, scope, skip, sort, source, start, summary, with_meta. Use count and format to keep large tables small, e.g. {"count": 50, "format": "name|subnet"}. filter applies to cmdb paths; monitor/firewall/session ignores it and takes source or destination.

    The row selectors ``filter``, ``key``, ``pattern`` and ``sort``
    are refused where they could reveal what the response hides: on
    SNMP community tables (any ``community``/``snmp-community``
    segment, anything under ``system.snmp``), on a field whose name
    marks a secret (``filter=password=@a``), and entirely while
    output masking is on, since a substring match or a sort on an
    address field recovers a masked address one query at a time.
    ``filter`` must be ``field<op>value`` clauses joined by commas
    (ops ``==``, ``!=``, ``=@``, ``!@``, ``<``, ``<=``, ``>``,
    ``>=``); a comma inside a value is refused, not guessed at.
    ``source``/``destination`` stay available with masking on: they
    take one whole address, the same exact lookup
    ``get_device_client_location`` accepts.

Returns: dict with keys: - adom, device, path - http_status, version, build: as reported by the device - results: the device's answer, secrets redacted - error / error_code: on failure

Example: >>> await query_device_api("/api/v2/monitor/router/bgp/neighbors", "branch1")

Inputs: path (required), adom, vdom, device, +1 more. Returns: object

reload_device_listA

Reload the device list from FortiManager database.

Forces FortiManager to refresh its device cache. Useful after direct database changes or if device list appears stale.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root")

Returns: dict: Reload result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom. Returns: object

remove_device_from_groupA

Remove a single device from a device group.

Args: adom: ADOM name group: Device group name device: Device name to remove vdom: Device VDOM to remove (default: "root")

Returns: dict: Remove result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await remove_device_from_group("root", "Branch-Firewalls", "FGT-Branch1")

Inputs: adom (required), group (required), device (required), vdom. Returns: object

remove_devices_from_group_bulkA

Remove multiple devices from a device group in one call.

Args: adom: ADOM name group: Device group name devices: List of device names to remove vdom: VDOM the devices were added on (default: "root")

Returns: dict: Remove result with keys: - status: "success" or "error" - requested_count: Number of devices in the request. NOT a count of memberships actually changed: FortiManager's DELETE on a non-member is a lenient no-op that still reports success, so a device that was never in the group is indistinguishable from one that was removed. - message: Status or error message

Example: >>> result = await remove_devices_from_group_bulk( ... "root", "Branch-Firewalls", ["FGT-Site1", "FGT-Site2"] ... )

Inputs: adom (required), group (required), devices (required), vdom. Returns: object

remove_group_from_groupB

Remove a nested group from its parent device group.

Args: adom: ADOM name parent_group: Group that currently contains child_group child_group: Nested group to remove from parent_group

Returns: dict: Remove result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await remove_group_from_group("root", "All-Branches", "Branch-Firewalls")

Inputs: adom (required), child_group (required), parent_group (required). Returns: object

remove_ips_sensor_signature_overrideA

Remove a signature filter/override entry from an IPS sensor.

Use list_ips_sensor_signature_overrides to find the entry's "id" first if it is not already known.

Args: adom: ADOM name sensor: IPS sensor name entry_id: ID of the entry to remove (as returned in its "id" field)

Returns: dict: Remove result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), sensor (required), entry_id (required). Returns: object

resolve_datasourceA

Resolve the objects a config attribute is allowed to reference.

Generic config-DB introspection built on FortiManager's option: datasrc mechanism: given a cdb table url and an attribute name attr, FMG returns every object attr may reference. For example, the objects an SD-WAN service (steering) rule can point at -- internet-service-names, address groups, etc. Documented generically in the swagger cdb get-params (params.cdb.get.table.option.opts -> datasrc, requires attr).

Only pm/config endpoints are accepted -- arbitrary URLs are rejected.

Args: url: A cdb config path, e.g. "pm/config/adom/root/obj/system/sdwan" attr: The attribute whose referenceable objects to resolve, e.g. "internet-service-name" or "service" adom: ADOM name (informational; default: DEFAULT_ADOM env var or "root")

Returns: dict with keys: - url, attr, adom - datasource: raw list/dict of referenceable objects - error / error_code: on failure

Inputs: url (required), attr (required), adom. Returns: object

revert_adom_revisionA

Revert the live ADOM DB to a past revision.

FortiManager has no dedicated revert-ADOM-revision call. The documented mechanism (How-To 013, "How to revert an ADOM Revision?") is to clone the target past revision: this both restores the live ADOM DB to that historical state and records the clone itself as a brand-new revision. This writes to the ADOM DB (a pure ADOM object, not a device) -- push any restored policy/object changes to devices separately with preview_install

  • install_package/install_device_settings as needed.

Safety: governed by FMG_REVERT_SAFETY (default "strict"), same pattern as trigger_fmg_restore -- refused unless confirm=True is also passed. A clone-revert has no dry-run or content-screening equivalent (unlike the firewall-policy revert, which is gated by content instead): it replaces the entire live ADOM DB in one call, so the gate is a plain explicit confirmation. Set FMG_REVERT_SAFETY=disabled to remove it.

Args: adom: ADOM name revision: Revision number to revert to (the version field from list_adom_revisions) name: Name for the newly-created revision (default: "Restored-rev_{revision}") desc: Description for the newly-created revision (default: "Revert of ADOM Revision #{revision}") locked: Protect the newly-created revision from deletion (default False) confirm: Must be True to proceed under FMG_REVERT_SAFETY=strict (default). Ignored when FMG_REVERT_SAFETY=disabled.

Returns: dict: status, adom, reverted_from, new_revision, message

Inputs: adom (required), revision (required), desc, name, +2 more. Returns: object

revert_device_revisionA

Revert a device's device DB to a past revision.

This rewrites FortiManager's stored device DB copy for device only -- the live FortiGate is not touched. Push the reverted device DB to the device the same way any other device DB change is pushed: preview_install then install_device_settings.

Safety: governed by FMG_REVERT_SAFETY (default "strict"), same pattern as revert_adom_revision -- refused unless confirm=True is also passed. Set FMG_REVERT_SAFETY=disabled to remove it.

Note: Requires the device to have at least one device DB revision on record -- see the note on list_device_revisions. Not live-tested (reverting a device's config is a real, consequential write); the request shape matches the FNDN-documented, non-deprecated /deployment/revert command exactly (see client.py), which the sibling get/checkout calls confirm works correctly on this FMG generation for devices that have revision history.

Args: device: Managed device name revision: Revision number to revert to (see list_device_revisions) confirm: Must be True to proceed under FMG_REVERT_SAFETY=strict (default). Ignored when FMG_REVERT_SAFETY=disabled.

Returns: dict: status, device, revision, message

Inputs: device (required), revision (required), confirm. Returns: object

revert_firewall_policyA

Restore a firewall policy to a past change-log snapshot.

FortiManager has no dedicated revert-firewall-policy endpoint. The documented mechanism (How-To 008, "How to revert a firewall policy from a past changes?") is to capture a past change's config snapshot from list_policy_revisions and update the live policy with it -- this tool does exactly that. This writes a policy OBJECT inside the ADOM's policy package; it does not touch any device. Push the reverted policy to devices the same way any other policy edit is pushed: preview_install then install_package.

Args: adom: ADOM name package: Policy package name config: A snapshot from list_policy_revisions' "config" field -- either the JSON string as returned, or the already-decoded dict. Must include "policyid". Any "oid" key is stripped automatically (FortiManager rejects the write if it is present). revision_note: Optional note recorded against this change

Returns: dict: status, adom, package, policyid, message

Example: >>> revisions = await list_policy_revisions("demo", "ppkg_001", policyid=14) >>> await revert_firewall_policy( ... "demo", "ppkg_001", revisions["changes"][0]["config"], ... revision_note="Revert from create time", ... )

Inputs: adom (required), config (required), package (required), revision_note. Returns: object

search_devicesA

Search for devices with filters.

Args: adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") name_filter: Filter by device name (partial match) platform_filter: Filter by platform type (e.g., "FortiGate-VM") os_version_filter: Filter by OS version as major[.minor[.patch]] (e.g., "7", "7.4" or "7.4.12"; a leading "v" is accepted) connection_status: Filter by status ("up" or "down")

Returns: dict: Search results with keys: - status: "success" or "error" - count: Number of matching devices - devices: List of matching device objects - message: Error message if failed

Example: >>> # Find all FortiGate VMs >>> result = await search_devices(platform_filter="FortiGate-VM")

>>> # Find offline devices
>>> result = await search_devices(connection_status="down")

>>> # Find devices by name pattern
>>> result = await search_devices(name_filter="Branch")

Inputs: adom, name_filter, platform_filter, connection_status, +1 more. Returns: object

search_firewall_policiesA

Search firewall policies with filters.

Args: adom: ADOM name package: Policy package name name_filter: Filter by policy name (partial match) srcaddr_filter: Filter by source address (partial match) dstaddr_filter: Filter by destination address (partial match) service_filter: Filter by service (partial match) action_filter: Filter by action ("accept" or "deny") status_filter: Filter by status ("enable" or "disable")

Returns: dict: Search results with keys: - status: "success" or "error" - count: Number of matching policies - policies: List of matching policy objects - message: Error message if failed

Example: >>> # Find all deny policies >>> result = await search_firewall_policies( ... adom="root", ... package="default", ... action_filter="deny" ... )

>>> # Find policies using a specific address
>>> result = await search_firewall_policies(
...     adom="root",
...     package="default",
...     srcaddr_filter="Server-Subnet"
... )

Inputs: adom (required), package (required), name_filter, action_filter, +4 more. Returns: object

search_objectsA

Search across all firewall objects by name.

Searches addresses, address groups, services, and service groups for objects matching the search term.

Args: adom: ADOM name search_term: Search term (partial match). Must not be empty; to list every object of a type, use list_addresses, list_address_groups, list_services or list_service_groups.

Returns: dict: Search results with keys: - status: "success" or "error" - addresses: Matching address objects - address_groups: Matching address groups - services: Matching service objects - service_groups: Matching service groups - total_count: Total matches - message: Error message if failed

Example: >>> result = await search_objects("root", "web")

Inputs: adom (required), search_term (required). Returns: object

set_metadata_variableA

Set a device's value for an existing metadata variable.

A device can hold one mapping per scope, for example "global" and "root", and templates can read either, so a value changed in one scope alone can leave the other behind. Without vdom every mapping the device has is changed; a device without any gets a "global" mapping.

Only FortiManager changes here. Templates use the new value at the next install: run preview_install(package=None) first, because a variable such as branch_id can move LAN addresses and BGP identities.

Args: adom: ADOM name name: Variable name (it must already exist) device: Managed device name value: New value: one line, at most 255 characters, no newlines or other control characters and none of ", \, #, {{, {%, {# or $( (templates paste it into CLI as is) vdom: Only this scope (optional, e.g. "global" or "root")

Returns: dict: status, variable, device, changes[{vdom, old, new}] (password variables redacted), or message on failure. A failure after some scopes were written also carries changes, for those scopes only

Inputs: adom (required), name (required), value (required), device (required), +1 more. Returns: object

start_packet_captureB

Start a packet capture from an existing definition.

Args: capture_id: ID of an existing packet capture definition (see list_packet_captures() or add_packet_capture())

Returns: dict: Start result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await start_packet_capture(1)

Inputs: capture_id (required). Returns: object

stop_packet_captureB

Stop a running packet capture.

Args: capture_id: ID of an existing packet capture definition

Returns: dict: Stop result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await stop_packet_capture(1)

Inputs: capture_id (required). Returns: object

trigger_fmg_backupA

Trigger a FortiManager system backup to a remote server.

Starts an asynchronous backup of the FortiManager's own configuration to an external FTP/SCP/SFTP/TFTP server. This is a FortiManager-itself operation -- it does not touch any managed device. Use wait_for_task() or get_task() (system_tools.py) to monitor completion; once done, the backup file is on the remote server at the given filename.

Args: service: Transfer protocol - "ftp", "scp", "sftp", or "tftp" server: Remote server hostname or IP address filename: Destination path and file name on the remote server (e.g. "tmp/fmg_backup.dat") username: Login username for the remote server (required for ftp/ scp/sftp; optional) userpasswd: Login password for the remote server (optional) port: Remote server port (optional; protocol default used if unset) passwd: Password to encrypt the backup file with (optional; FMG 7.0.11+/7.2.5+/7.4.2+ no longer allow an unencrypted backup)

Returns: dict: Backup result with keys: - status: "success" or "error" - task_id: Task ID for monitoring (if returned) - message: Status or error message

Example: >>> result = await trigger_fmg_backup( ... service="ftp", ... server="10.210.35.207", ... filename="tmp/fmg_backup.dat", ... username="tiger", ... userpasswd="fortinet", ... passwd="fortinet", ... ) >>> if result["status"] == "success": ... await wait_for_task(result["task_id"])

Inputs: server (required), service (required), filename (required), port, +3 more. Returns: object

trigger_fmg_restoreA

Restore the FortiManager system from a backup on a remote server.

Restores the FortiManager's own configuration from a backup file previously uploaded to an external FTP/SCP/SFTP/TFTP server (see trigger_fmg_backup). This is a disruptive, FortiManager-itself operation -- it does not touch any managed device, but it does REPLACE FMG's ENTIRE configuration and will interrupt the FMG service.

Safety: governed by FMG_RESTORE_SAFETY (default "strict"). Under strict, this call is refused unless confirm=True is also passed -- unlike install_package (gated by a verified preview) or firewall policy writes (gated by content screening), there is no dry-run or content check possible for a restore, so the gate is a plain explicit confirmation instead. Set FMG_RESTORE_SAFETY=disabled to remove the gate entirely.

Args: service: Transfer protocol - "ftp", "scp", "sftp", or "tftp" server: Remote server hostname or IP address filename: Path and file name of the backup on the remote server username: Login username for the remote server (optional) userpasswd: Login password for the remote server (optional) port: Remote server port (optional; protocol default used if unset) passwd: Password to decrypt the backup file, if it was encrypted (optional) confirm: Must be True to proceed under FMG_RESTORE_SAFETY=strict (default). Ignored when FMG_RESTORE_SAFETY=disabled.

Returns: dict: Restore result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await trigger_fmg_restore( ... service="ftp", ... server="10.210.35.207", ... filename="tmp/fmg_backup.dat", ... username="tiger", ... userpasswd="fortinet", ... confirm=True, ... )

Inputs: server (required), service (required), filename (required), port, +4 more. Returns: object

unassign_sdwan_templateB

Unassign an SD-WAN template from a device.

Args: adom: ADOM name template: SD-WAN template name device: Device name to unassign vdom: VDOM name (default: root)

Returns: Unassignment result

Inputs: adom (required), device (required), template (required), vdom. Returns: object

unassign_system_templateA

Unassign a system template from a device.

Args: adom: ADOM name template: System template name device: Device name to unassign vdom: VDOM name (default: root)

Returns: Unassignment result

Inputs: adom (required), device (required), template (required), vdom. Returns: object

unlock_adomA

Unlock an ADOM (workspace mode).

Release the lock on an ADOM. Changes should be committed before unlocking to persist them.

Args: adom: ADOM name to unlock

Returns: dict: Unlock result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required). Returns: object

update_addressA

Update an existing address object.

Only specified fields will be updated.

Args: adom: ADOM name name: Current address name new_name: New name (optional) subnet: New subnet for ipmask type (optional) fqdn: New FQDN for fqdn type (optional) comment: New comment (optional)

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), fqdn, subnet, +2 more. Returns: object

update_address_groupB

Update an address group.

Args: adom: ADOM name name: Group name members: New member list (replaces existing) comment: New comment

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, members. Returns: object

update_antivirus_profileA

Update an existing antivirus profile.

Only specified fields will be updated.

Args: adom: ADOM name name: Profile name comment: New comment (optional) feature_set: New flow/proxy feature set - "proxy" or "flow" (optional) scan_mode: New scan mode - "default" or "legacy" (optional) av_virus_log: New AntiVirus logging setting - "enable" or "disable" (optional)

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, scan_mode, +2 more. Returns: object

update_application_listA

Update an existing application-control list.

Only specified fields will be updated.

Args: adom: ADOM name name: List name comment: New comment (optional) deep_app_inspection: New deep-inspection setting - "enable" or "disable" (optional) unknown_application_action: New unknown-application action - "pass" or "block" (optional) other_application_action: New other-application action - "pass" or "block" (optional)

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, deep_app_inspection, +2 more. Returns: object

update_bgp_templateA

Change neighbor-group options inside a BGP provisioning template.

Only FortiManager changes here: the devices follow at the next install, so run preview_install(package=None) first. BGP then needs a route refresh, for example execute router clear bgp all soft out, before peers receive what a new route-reflector client should get.

The neighbor-group path is not in the bundled FNDN specs; it is verified live on FortiManager 8.0.2 only.

Args: adom: ADOM name name: BGP template name (list_templates entries whose template setting.stype is router_bgp) neighbor_group: Neighbor group name, e.g. "EDGE" settings: Options to change: route-reflector-client, next-hop-self, next-hop-self-rr, soft-reconfiguration ("enable"/"disable") and advertisement-interval (seconds). Anything else is refused.

Returns: dict: adom, name, neighbor_group, before, after (values read back from FortiManager, 1/0 for enable/disable), or error / error_code on failure

Inputs: adom (required), name (required), settings (required), neighbor_group (required). Returns: object

update_deviceA

Update device properties.

Modify device metadata like description and location.

Args: adom: ADOM name device: Device name description: New device description latitude: GPS latitude for device location longitude: GPS longitude for device location

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Example: >>> result = await update_device( ... adom="root", ... device="FGT-HQ", ... description="Main headquarters firewall", ... latitude=37.7749, ... longitude=-122.4194 ... )

Inputs: adom (required), device (required), latitude, longitude, +1 more. Returns: object

update_device_dhcp_serverA

Update a device-DB DHCP server scope by id. Only provided fields change.

The lease range is replaced as a whole, so start_ip and end_ip must be given together.

Args: device: Managed device name dhcp_server_id: Numeric scope id (see list_device_dhcp_servers) start_ip: New first address of the lease range end_ip: New last address of the lease range netmask: New scope netmask default_gateway: New gateway handed to clients dns_servers: Up to three DNS servers; replaces the served set lease_time: New lease time in seconds vdom: VDOM the scope lives in (default "root")

Returns: Update result

Inputs: device (required), dhcp_server_id (required), vdom, end_ip, +5 more. Returns: object

update_device_interfaceA

Update fields on a device-DB interface. Only provided fields change.

Args: device: Managed device name name: Interface name to update ip: New address, CIDR or "address netmask" form allowaccess: Replacement administrative-access list role: Interface role: lan, wan, dmz or undefined alias: Short alias shown in the GUI description: Interface description vlanid: New VLAN id (1-4094)

Returns: Update result

Inputs: name (required), device (required), ip, role, +4 more. Returns: object

update_device_ipsec_phase1_interfaceA

Update fields on a device-DB IPsec phase1-interface. Only provided fields change.

Args: device: Managed device name name: Phase1-interface (remote gateway) name to update interface: New local outgoing interface type: New remote gateway type: "static", "dynamic" or "ddns" remote_gw: New remote gateway IPv4 address psksecret: New pre-shared key, 6-128 characters ike_version: New IKE protocol version, "1" or "2" mode: New IKEv1 ID protection mode: "main" or "aggressive" peertype: New peer ID acceptance mode proposal: Replacement phase1 proposal list dhgrp: Replacement phase1 DH group list nattraversal: New NAT traversal setting dpd: New Dead Peer Detection mode keylife: New phase1 key life in seconds comments: New free-text comment vdom: VDOM the gateway lives in (default "root")

Returns: Update result with any echoed credential stripped

Inputs: name (required), device (required), dpd, mode, +12 more. Returns: object

update_device_ipsec_phase2_interfaceA

Update fields on a device-DB IPsec phase2-interface. Only provided fields change.

Args: device: Managed device name name: Phase2-interface (tunnel) name to update phase1name: New parent phase1-interface name src_subnet: New local proxy ID subnet, CIDR or "address netmask" form dst_subnet: New remote proxy ID subnet, same accepted forms proposal: Replacement phase2 proposal list dhgrp: Replacement phase2 DH group list pfs: New Perfect Forward Secrecy setting replay: New replay detection setting keepalive: New keep-alive setting auto_negotiate: New IPsec SA auto-negotiation setting keylifeseconds: New phase2 key life in seconds (120-172800) comments: New free-text comment vdom: VDOM the tunnel lives in (default "root")

Returns: Update result

Inputs: name (required), device (required), pfs, vdom, +10 more. Returns: object

update_device_sslvpn_settingsA

Update the SSL-VPN (Agentless VPN) settings object in a device's device DB.

Only provided fields change -- see get_device_sslvpn_settings for the current state to base a partial update on.

Args: device: Managed device name status: Enable/disable SSL-VPN: "disable" or "enable" port: SSL-VPN access port (1-65535) source_interface: Source interface names of incoming traffic default_portal: Default web portal name (see update_device_sslvpn_web_portal) servercert: Server certificate name to present to clients idle_timeout: Idle timeout in seconds before disconnect auth_timeout: Authentication timeout in seconds (1-259200, 0 = no timeout) dns_server1: Primary DNS server handed to clients dns_server2: Secondary DNS server handed to clients reqclientcert: Require client certificates: "disable" or "enable" https_redirect: Redirect port 80 to the SSL-VPN port: "disable" or "enable" ssl_min_proto_ver: Minimum TLS version: "tls1-0", "tls1-1", "tls1-2" or "tls1-3" vdom: VDOM the settings apply to (default "root")

Returns: Update result

Inputs: device (required), port, vdom, status, +10 more. Returns: object

update_device_sslvpn_web_portalA

Update an SSL-VPN web portal in a device's device DB.

The portal itself must already exist in the device DB (created via the FortiOS CLI/GUI or a prior install) -- this tool only updates an existing entry, matching the "get/update" scope of this module. Only provided fields change.

Args: device: Managed device name name: Web portal name to update tunnel_mode: Enable/disable full-tunnel mode: "disable" or "enable" split_tunneling: Enable/disable split tunneling: "disable" or "enable" ip_pools: Firewall address/address-group names to draw tunnel-mode client IPs from web_mode: Enable/disable web-mode (clientless HTML5) access: "disable" or "enable" dns_server1: Primary DNS server handed to portal clients dns_server2: Secondary DNS server handed to portal clients vdom: VDOM the portal lives in (default "root")

Returns: Update result

Inputs: name (required), device (required), vdom, ip_pools, +5 more. Returns: object

update_device_wtpA

Update fields on a device-DB managed FortiAP. Only provided fields change.

Repointing wtp_profile drops a reference from the old profile. FortiManager prunes a wtp-profile that no wtp entry references on install (see create_device_wtp), so moving the last AP off a profile loses that profile on the next install_device_settings.

Args: device: Managed device name wtp_id: FortiAP serial number (the wtp-id / table mkey) wtp_profile: New FortiAP (WTP) profile name to assign name: New friendly display name admin: New authorization state: "discovered", "enable" or "disable" location: New free-text location string comment: New free-text comment vdom: VDOM the AP is registered in (default "root")

Returns: Update result

Inputs: device (required), wtp_id (required), name, vdom, +4 more. Returns: object

update_device_wtp_profile_radioA

Update a single radio's channel and/or channel width on a FortiAP profile.

This is a read-modify-write, like assign_vap_to_wtp_profile: the profile is read first and every other field already on the target radio (band, power, vap-all, vaps, mode, ...) is carried through unchanged, minus a couple of read-only bookkeeping keys the API injects on GET but rejects on write (see _WTP_RADIO_READONLY_KEYS). FortiManager replaces a nested radio object rather than merging into it, so writing back only channel/channel-bonding would reset the rest to defaults on the next install_device_settings.

Args: device: Managed device name profile: FortiAP (WTP) profile name radio: Radio to update, 1-3 channel: Channel(s) to pin the radio to. For radio 1/2 (2.4/5GHz) this is a single-element list, e.g. [36], to pin one channel. For radio 3 (6GHz) at a bonding width above 20MHz, FortiOS represents the wide channel as the full list of its member 20MHz sub-channels rather than a single label -- pass either the single conventional wide-channel label (e.g. [15] for 160MHz channel 15) and it is expanded to the correct member list automatically, or the explicit member list itself (e.g. [1, 5, 9, 13, 17, 21, 25, 29]). channel_bonding: Channel width/bonding, one of WTP_PROFILE_CHANNEL_BONDING_MODES ("20MHz", "40MHz", "80MHz", "160MHz") vdom: VDOM the profile lives in (default "root")

Returns: Update result

Inputs: radio (required), device (required), profile (required), vdom, +2 more. Returns: object

update_dlp_profileB

Update a DLP profile's top-level settings.

Only specified fields will be updated.

Args: adom: ADOM name name: Profile name comment: New comment feature_set: Flow or proxy-based inspection ("flow" or "proxy") dlp_log: Enable/disable DLP logging extended_log: Enable/disable extended logging

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, dlp_log, +2 more. Returns: object

update_dnsfilter_profileA

Update an existing DNS filter profile.

Only specified fields will be updated.

Args: adom: ADOM name name: Profile name comment: New comment (optional) block_action: New blocked-domain action - "block", "redirect", or "block-sevrfail" (optional) block_botnet: New botnet C&C blocking setting - "enable" or "disable" (optional) safe_search: New safe search setting - "enable" or "disable" (optional)

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, safe_search, +2 more. Returns: object

update_firewall_policyA

Update an existing firewall policy.

Only the specified fields will be updated; other fields remain unchanged.

Args: adom: ADOM name package: Policy package name policyid: Policy ID to update name: New policy name (optional) srcintf: New source interfaces (optional) dstintf: New destination interfaces (optional) srcaddr: New source addresses (optional) dstaddr: New destination addresses (optional) service: New services (optional) action: New action - "accept" or "deny" (optional) schedule: New schedule (optional) nat: Enable/disable NAT (optional) logtraffic: New log mode (optional) status: New status (optional) comments: New comments (optional) global_label: Policy section label (optional) global_label_color: Policy section color ID 0-31 (optional) srcaddr_negate: Match all sources EXCEPT srcaddr (optional; None leaves the field untouched, like every other optional field) dstaddr_negate: Match all destinations EXCEPT dstaddr (optional) service_negate: Match all services EXCEPT service (optional) utm_status: Enable/disable security profile inspection (optional) av_profile: Antivirus profile name (optional) ips_sensor: IPS sensor name (optional) webfilter_profile: Web filter profile name (optional) dnsfilter_profile: DNS filter profile name (optional) application_list: Application control list name (optional) file_filter_profile: File filter profile name (optional) ssl_ssh_profile: SSL/SSH inspection profile name (optional) profile_protocol_options: Protocol options profile name (optional). Mutually exclusive with profile_group in the same call -- it is itself a member of the FortiOS firewall profile-group object profile_group: Security profile group name (optional). Mutually exclusive with av_profile, ips_sensor, webfilter_profile, dnsfilter_profile, application_list, file_filter_profile, ssl_ssh_profile, and profile_protocol_options in the same call install_on: Replace the policy's install-on targets (optional): devices {"name": "branch1", "vdom": "root"} and/or device groups {"name": "emea_spokes"}. An empty list clears them, so the policy installs on every device the package goes to

Note: Sending any individual security-profile field (av_profile, ssl_ssh_profile, profile_protocol_options, etc.) on a policy that is currently in group mode flips profile-type to "single" on the appliance. The previously-stored profile-group value becomes dormant (not deleted) rather than staying active alongside the new field -- FortiOS only honors one profile-type at a time.

Returns: dict: Update result with keys: - status: "success" or "error" - policyid: Updated policy ID - message: Status or error message

Example: >>> # Disable a policy >>> result = await update_firewall_policy( ... adom="root", ... package="default", ... policyid=10, ... status="disable" ... )

>>> # Update source addresses
>>> result = await update_firewall_policy(
...     adom="root",
...     package="default",
...     policyid=10,
...     srcaddr=["New-Subnet", "Other-Subnet"]
... )

Inputs: adom (required), package (required), policyid (required), nat, +27 more. Returns: object

update_ips_sensorA

Update an IPS sensor's top-level settings.

Only specified fields will be updated. To change signature filters/overrides use add_ips_sensor_signature_override / remove_ips_sensor_signature_override instead.

Args: adom: ADOM name name: Sensor name comment: New comment block_malicious_url: Enable/disable malicious URL blocking scan_botnet_connections: Botnet-server connection handling ("disable", "block", or "monitor") extended_log: Enable/disable extended logging

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, extended_log, +2 more. Returns: object

update_local_in_policyA

Update an existing IPv4 local-in policy.

Only the specified fields will be updated; other fields remain unchanged.

Args: adom: ADOM name package: Policy package name policyid: Local-in policy ID to update action: New action - "accept" or "deny" (optional) intf: New incoming interface(s) (optional) srcaddr: New source addresses (optional) dstaddr: New destination addresses (optional) service: New services (optional) schedule: New schedule (optional) status: New status - "enable" or "disable" (optional) logtraffic: New local-in traffic logging setting (optional) comments: New comments (optional) srcaddr_negate: Match all sources EXCEPT srcaddr (optional) dstaddr_negate: Match all destinations EXCEPT dstaddr (optional) service_negate: Match all services EXCEPT service (optional) ha_mgmt_intf_only: Restrict this policy to the HA management interface only (optional). IPv4-only field. virtual_patch: Enable/disable virtual patching on this policy (optional)

Returns: dict: Update result with keys: - status: "success" or "error" - policyid: Updated policy ID - message: Status or error message

Example: >>> # Disable a local-in policy >>> result = await update_local_in_policy( ... adom="root", ... package="default", ... policyid=1, ... status="disable" ... )

Inputs: adom (required), package (required), policyid (required), intf, +13 more. Returns: object

update_local_in_policy6A

Update an existing IPv6 local-in policy.

Only the specified fields will be updated; other fields remain unchanged.

Args: adom: ADOM name package: Policy package name policyid: Local-in policy6 ID to update action: New action - "accept" or "deny" (optional) intf: New incoming interface(s) (optional) srcaddr: New source IPv6 addresses (optional) dstaddr: New destination IPv6 addresses (optional) service: New services (optional) schedule: New schedule (optional) status: New status - "enable" or "disable" (optional) logtraffic: New local-in traffic logging setting (optional) comments: New comments (optional) srcaddr_negate: Match all sources EXCEPT srcaddr (optional) dstaddr_negate: Match all destinations EXCEPT dstaddr (optional) service_negate: Match all services EXCEPT service (optional) virtual_patch: Enable/disable virtual patching on this policy (optional)

Returns: dict: Update result with keys: - status: "success" or "error" - policyid: Updated policy ID - message: Status or error message

Example: >>> result = await update_local_in_policy6( ... adom="root", ... package="default", ... policyid=1, ... status="disable" ... )

Inputs: adom (required), package (required), policyid (required), intf, +12 more. Returns: object

update_scriptA

Update an existing CLI script.

Args: adom: ADOM name name: Script name to update content: New script content description: New description script_type: New script type target: New target

Returns: Updated script details

Inputs: adom (required), name (required), target, content, +2 more. Returns: object

update_serviceB

Update a service object.

Args: adom: ADOM name name: Service name tcp_portrange: New TCP port range udp_portrange: New UDP port range comment: New comment

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, tcp_portrange, +1 more. Returns: object

update_service_groupB

Update a service group.

Args: adom: ADOM name name: Group name members: New member list (replaces existing) comment: New comment

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, members. Returns: object

update_ssl_ssh_profileA

Update an SSL/SSH inspection profile.

Only specified fields will be updated.

Args: adom: ADOM name name: Profile name comment: New comment ssl_inspection: Generic SSL inspection level ("disable", "certificate-inspection", or "deep-inspection") https_inspection: HTTPS inspection level ("disable", "certificate-inspection", or "deep-inspection") caname: New CA certificate(s) (datasource names, replaces existing) untrusted_caname: New untrusted CA certificate(s) (replaces existing) server_cert: New server certificate(s) (replaces existing) server_cert_mode: Re-sign or replace the server's certificate mapi_over_https: Enable/disable inspection of MAPI over HTTPS rpc_over_https: Enable/disable inspection of RPC over HTTPS

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), caname, comment, +7 more. Returns: object

update_waf_profileA

Update a WAF profile's top-level settings.

Only specified fields will be updated.

Args: adom: ADOM name name: Profile name comment: New comment external: Enable/disable external HTTP inspection extended_log: Enable/disable extended logging

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, external, +1 more. Returns: object

update_webfilter_profileA

Update an existing web filter profile.

Only specified fields will be updated.

Args: adom: ADOM name name: Profile name comment: New comment (optional) feature_set: New flow/proxy feature set - "proxy" or "flow" (optional) log_all_url: New "log all URLs" setting - "enable" or "disable" (optional) web_content_log: New blocked-content logging setting - "enable" or "disable" (optional)

Returns: dict: Update result with keys: - status: "success" or "error" - message: Status or error message

Inputs: adom (required), name (required), comment, feature_set, +2 more. Returns: object

upgrade_device_firmwareA

Trigger a firmware upgrade on a managed device.

Device-affecting: this reboots the device onto the new firmware. Asynchronous -- FortiManager runs the upgrade as a background task (create_task="enable" is always sent) and this returns immediately with a task_id. Poll it with get_task/wait_for_task rather than assuming success from this call's return.

Strongly recommended to call get_firmware_upgrade_path first: FMG may need to step the device through intermediate versions to reach the target, and this tool upgrades straight to target_version without walking that path itself.

Safety: governed by FMG_FIRMWARE_SAFETY (default "strict"), same pattern as trigger_fmg_restore -- refused unless confirm=True is also passed. A firmware upgrade reboots a real managed device onto new code; there is no dry-run and no content to screen, so the gate is a plain explicit confirmation. This is unrelated to spawn_guarded below, which only bounds concurrency, not whether the call is allowed to happen at all. Set FMG_FIRMWARE_SAFETY=disabled to remove the gate.

Args: device: Managed device name target_version: Target firmware version, e.g. "7.2.9-b1688" adom: ADOM name (default: from DEFAULT_ADOM env var, or "root") vdom: VDOM to scope the request to (optional) flags: One upgrade flag (optional): "f_boot_alt_partition" (boot from alternate partition after upgrade), "f_skip_retrieve" (don't retrieve device config after upgrade), "f_skip_multi_steps" (skip the multi-step upgrade process), "f_skip_fortiguard_img" (let the device download firmware from FortiGuard itself) schedule_time: Schedule the upgrade for a future time instead of running it immediately (optional; FMG-native time format) confirm: Must be True to proceed under FMG_FIRMWARE_SAFETY=strict (default). Ignored when FMG_FIRMWARE_SAFETY=disabled.

Returns: dict: Trigger result with keys: - status: "success" or "error" - task_id: Task ID for monitoring (if successful) - message: Status or error message

Example: >>> path = await get_firmware_upgrade_path("FGT-HQ", "7.2.9-b1688") >>> result = await upgrade_device_firmware( ... "FGT-HQ", "7.2.9-b1688", confirm=True ... ) >>> if result["status"] == "success": ... await wait_for_task(result["task_id"], timeout=1800)

Inputs: device (required), target_version (required), adom, vdom, +3 more. Returns: object

validate_templateA

Validate a template group for a device.

Checks that all metadata variables are resolved for the device.

Args: adom: ADOM name template_group: Template group name device: Target device name vdom: VDOM name (default: root)

Returns: Task ID for monitoring validation progress

Inputs: adom (required), device (required), template_group (required), vdom. Returns: object

wait_for_taskA

Wait for a task to complete.

Polls the task status until it completes or times out. Useful for waiting on installation or provisioning operations.

Args: task_id: Task ID number timeout: Maximum wait time in seconds (default: 300, capped at 3600) poll_interval: Seconds between status checks (default: 5)

Returns: dict: Final task status with keys: - status: "success" (task ended done or warning) or "error" (error, cancelled, aborted, timeout) - task: Final task object - task_state: Decoded end state (done, warning, error, cancelled, aborted) - completed: Whether task completed (vs timeout) - message: Status or error message

A "warning" task finished; its lines (get_task) say what was
skipped, e.g. an install that found nothing to push.

Example: >>> # Wait for policy installation >>> result = await wait_for_task(12345, timeout=600) >>> if result['completed']: ... print("Installation finished!")

Inputs: task_id (required), timeout, poll_interval. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 254 tools

    Disambiguation3/5

    The server has 254 tools and many tightly related clusters (e.g. get_device_bgp vs get_device_bgp_status, get_sdwan_template vs get_device_sdwan vs get_sdwan_template_config, get_device_interfaces vs get_device_interface_config, create_device_sniffer vs create_device_on_demand_sniffer). Descriptions do a good job of explaining differences, but the sheer volume and several near-duplicate list/get tools make misselection likely for an agent under pressure.

    Naming Consistency4/5

    The dominant pattern is verb_noun in snake_case (list_devices, get_device, create_firewall_policy, delete_package, update_antivirus_profile), with bulk variants clearly marked (add_devices_bulk, delete_firewall_policies_bulk). Deviations like health_check, policy_lookup, and find_duplicate_objects are minor and still readable.

    Tool Count1/5

    At 254 tools the surface is far beyond what an agent can reliably navigate in one server; the rubric marks 50+ tools as an extreme mismatch. Many tools are legitimate but the set is massively over-scoped relative to a single MCP endpoint.

    Completeness4/5

    Coverage is extensive: full CRUD for addresses, services, policies, packages, devices, templates, and many device-DB objects, plus monitoring, install preview/install, and revision workflows. Some notable gaps remain (e.g. WAF/DLP/application-list rule sub-objects are only partially manageable, SSL-VPN web portals are update-only), but overall the domain is well covered.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to interact with FortiAnalyzer for log analysis, reporting, security monitoring, and SOC operations via the JSON-RPC API.
      21
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides programmatic access to FortiGate devices for managing firewall policies, routing, virtual IPs, and device operations, enabling integration with MCP-compatible clients like Claude Desktop.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to manage FortiGate firewalls from bootstrap to production, with safe preview/apply changes and secure credential handling. Covers inventory, VDOMs, interfaces, routing, firewall policies, VPN, security analysis, and documentation generation.
      MIT