Mats2208/MCP-Packet-Tracer
AI-powered Cisco Packet Tracer automation over MCP. Describe a network in natural language and it generates, validates and deploys full topologies (OSPF, EIGRP, RIP, DHCP).
bd3bc03590b8packet-tracer-mcp0.12.0 in pyproject.tomlPaths from tool input into commands, SQL, files and URLs
How much power the tools give an agent over the machine
Hidden instructions and poisoning in text for the model
Known vulnerabilities in the packages the server uses
How the server reads credentials and where they can go
Whether the tools do only what their descriptions say
How far the analysis went
The scanner traces each tool from its input to the operations its code performs, and here it could not follow every path. Code Safety is shown as partly traced instead of a score: no finding there is not a clean result. The score of Capability Exposure counts only what it could follow.
- In 372 places a tool's input is handed to a function whose name matches several definitions in the code; the scanner could not tell which one runs, so it stopped there
- 2 of 124 tools, prompts and resources could not be followed through the code
- 2 tools, prompts and resources registered only in the repository's tests are not counted on this page
Top risks in plain words
- HIGHTools
pt_activity_open,pt_full_build,pt_live_deploy,pt_validate_planread or write any file path by design: an agent steered by prompt injection can use them that way.
How to use it safely
Practical steps from what we found in this server. They lower the risk; they do not replace a review of the code.
- Give it only the folder it needs
pt_activity_open,pt_full_build,pt_live_deploy,pt_validate_plancan read or write any file path. Mount a single project folder, read-only where you can. - Turn off the tools you do not use
Most MCP clients let you disable single tools. If you do not need
pt_activity_open,pt_full_build,pt_live_deployand 1 more, switch them off. - Give it a narrowly scoped token
Its code reads credentials or environment variables. Use a key limited to what this server needs, not your main one.
- Keep confirmations on
Leave your MCP client's confirmation prompt on for tools that change files, run commands or send data.
What its tools can do on your machine
The server offers 113 tools, 6 resources, 3 prompts. When an AI agent calls them, this is what their code can do on the machine where the server runs, as traced in the source. Tools that call code the scanner could not follow may do more.
pt_activity_build_initial, pt_activity_check, pt_activity_create, pt_activity_create_exam, pt_activity_exit_wizard, pt_activity_mark and 44 morept_fast_forward, pt_full_build, pt_live_deploy, pt_plan_topology, pt_verify_connectivityNo tool was seen to: start other programs on the machine; connect to the internet or other hosts; read passwords, tokens or keys; touch sensitive locations.
Where its requests and secrets go
Read from the names along each tool's calls, not from a run: what the code says, not every address it may reach at run time.
The literal addresses the tools' requests name.
- None: no request names a fixed host.
Constants or settings that start an address; the value comes from configuration.
- None seen.
Credential-like environment variables. Give the server a key with the least access it needs.
- None: no credential-like variable is read by the tools.
Text it brings in from outside
Text that reaches the model from outside: an instruction hidden in it can steer the agent (prompt injection). Treat what these tools return as data, not as orders.
- files50 tools · pt_activity_build_initial, pt_activity_check, pt_activity_create +47
Tool annotations
No tool declares MCP annotations (readOnlyHint, destructiveHint and the rest). Clients use them to decide what to confirm; directories such as Anthropic's and OpenAI's ask for them.
Tools, prompts and resources (122: 113 tools, 6 resources, 3 prompts)
Open a row for its full description. Chips show what its code can reach, and which risky capability its own description declares.
pt_activity_opentool Opens a .pka activity in Packet Tracer; it replaces what is open.Filesoutside textReads/writes files
Opens a .pka activity in Packet Tracer; it replaces what is open.
Parameters:
- path: full path to an existing .pka (relative = inside the working directory).
- password: only for a protected activity, the instructor's password. It goes
to PT's confirmPassword and is neither stored nor echoed. Without it a
protected activity opens but its API stays locked.pt_full_buildtool Full pipeline: plans, validates, generates, explains, estimates and deploys.FilesEnv varsoutside textReads/writes files
Full pipeline: plans, validates, generates, explains, estimates and deploys.
deploy=True (default): with a channel to PT the topology is REALLY created (same path as
pt_live_deploy, with verification and reconcile) and project files are exported; with no
channel it falls back to manual mode (script to clipboard + step-by-step instructions).
Parameters:
- routers (1-20), pcs_per_lan, laptops_per_lan (Laptop-PT), switches_per_router, servers,
access_points (AccessPoint-PT, one per LAN), has_wan, dhcp.
- routing: static, ospf, eigrp, rip, none. ospf_process_id (1-65535, default 1),
eigrp_as (1-65535, default 100), floating_routes (static only: backup routes, AD 254).
- router_model: 1941, 2901, 2911, ISR4321. switch_model: 2960-24TT, 3560-24PS.
- template: single_lan, multi_lan, multi_lan_wan, star, hub_spoke, branch_office,
router_on_a_stick, three_router_triangle, custom.
- vlans: router_on_a_stick only; VLANs spread across the PCs (0 = default 2).
- dual_stack: add IPv6 (routers via CLI, hosts via SLAAC); ipv6_base (default "2001:db8::/32").
- wireless_laptops: laptops connect over WiFi (wireless NIC + AP).pt_live_deploytool Reads/writes files
No description.
pt_live_deploytool Sends commands directly to Packet Tracer in real time.FilesEnv varsoutside textReads/writes files
Sends commands directly to Packet Tracer in real time.
Requires PT open with the MCP Control Center extension installed. With the
window open HTTP is used; if you close it, the file channel (Script
Engine) takes over. The bridge starts by itself inside the MCP server.
Parameters:
- plan_json: plan JSON (output of pt_plan_topology or pt_full_build)
- plan_path: instead of plan_json, a .json file with the plan. Use it for
large hand-written designs (dozens of sites); `extra_cli` in the plan
carries per-device IOS lines (summaries, hardening, NAT...).
- command_delay: delay between BATCHES in seconds (default 0.0).
Commands are no longer sent one by one: they go in batches that PT runs in
a single runCode, where each one carries its own try/catch. Measured
against PT 9.0, creating 10 devices + links + configuring IOS in one go
takes ~100 ms and the config is applied. Raise it only if your
installation chokes.pt_validate_plantool Validates a topology plan. Returns typed errors and warnings.Filesoutside textReads/writes files
Validates a topology plan. Returns typed errors and warnings.
Parameters:
- plan_json: plan JSON (output of pt_plan_topology)
- plan_path: instead of plan_json, a .json file with the plan (large designs)ui_offprompt Packet Tracer: work headless again (API only, no windows opened)
Packet Tracer: work headless again (API only, no windows opened)
ui_onprompt Packet Tracer: show device actions in PT's real windows (CLI tab, Desktop apps) for screenshots
Packet Tracer: show device actions in PT's real windows (CLI tab, Desktop apps) for screenshots
ui_statusprompt Packet Tracer: report whether device actions run headless or in PT's windows
Packet Tracer: report whether device actions run headless or in PT's windows
resource_aliasesresource Common aliases for device models.
Common aliases for device models.
resource_cable_catalogresource Cable types available in Packet Tracer.
Cable types available in Packet Tracer.
resource_capabilitiesresource Server capabilities and version.
Server capabilities and version.
DERIVED from the live tool registry: instead of keeping a hand-maintained list
that can drift (it used to say nat="unsupported" while pt_apply_nat
existed), it introspects the tools that are actually registered and reports
the support of each feature based on whether its tool exists. If introspection
fails for any reason, it falls back to the static CAPABILITIES values.resource_device_catalogresource Full catalog of devices available in Packet Tracer.
Full catalog of devices available in Packet Tracer.
resource_guideresource Full usage guide: every rule, verified PT API fact and recipe (the short
Full usage guide: every rule, verified PT API fact and recipe (the short
server instructions point here).resource_templatesresource Available topology templates with descriptions.
Available topology templates with descriptions.
pt_activity_build_initialtool Copies the answer network to the initial network (confirming "Replace InitialFilesoutside text
Copies the answer network to the initial network (confirming "Replace Initial
Network?") and shows it. Nothing is erased here: the config students must
write is stripped with pt_cli / pt_host_ip_config.
Parameters:
- reset_config: include that next step in the reply.pt_activity_checktool Grades the open activity item by item: each leaf of the assessed tree with itsFilesoutside text
Grades the open activity item by item: each leaf of the assessed tree with its
path, ok, value and points. Empty nodes are ignored.
Parameters:
- only_incorrect: list only what is wrong.
- refresh: after opening, PT's counters are stale until the network changes.
True sets a host's gateway to its own value, an innocuous change that makes
PT recalculate, and then reads.pt_activity_createtool Starts a new activity: a new file with the Activity Wizard open. The canvas isFilesoutside text
Starts a new activity: a new file with the Activity Wizard open. The canvas is
then the answer network; build it with the normal tools.
Parameters:
- force: discard what is open. Without it the tool refuses when an activity
or a never-saved network is open (PT cannot tell if a saved one changed).pt_activity_create_examtool Builds a whole exam: create, build_answer, set_instructions, mark, points, connectivity,Filesoutside text
Builds a whole exam: create, build_answer, set_instructions, mark, points, connectivity,
copy_to_initial, clear_initial, save, exit_wizard.
Parameters:
- spec: title, situation, addressing [{device, interface, ip, mask, gateway}],
requirements [{text, items, note}] (**word** = bold), language (es/en),
items (paths for pt_activity_mark), plan or plan_path (the answer network),
answer_commands and initial_commands ({device: [config lines]}, typed between
configure terminal and end), points [{path, points}] (default 1 each; not on macOS),
connectivity [{source, destination, reachable}]
(ping tests PT grades; not on macOS), initial_hosts (hosts left with no address),
output_path (.pka), overwrite.
- start_at: step to resume from, after a failure.
- force: passed to pt_activity_create.
- dry_run: validate and render the HTML, sending nothing.
Reply: one entry per step, failed_step and how to retry.pt_activity_exit_wizardtool Closes the Activity Wizard, answering its two dialogs (New: No, Exit?: Yes) oneFilesoutside text
Closes the Activity Wizard, answering its two dialogs (New: No, Exit?: Yes) one
at a time. Save first: what is not saved is lost. PT clears the workspace.pt_activity_marktool Marks assessment items: setCheck(true) on the whole chain from the root.Filesoutside text
Marks assessment items: setCheck(true) on the whole chain from the root.
Parameters:
- items: paths, e.g. [["SW1", "Ports", "FastEthernet0/1", "Access VLAN"]].
- clear_others: uncheck everything else first.
Reply: marked, missing (with the step not found and the names there). A path
with a missing step changes nothing. Marks count after save and reopen.pt_activity_pointstool Sets how many points checked items are worth, with the Activity Wizard open.Filesoutside text
Sets how many points checked items are worth, with the Activity Wizard open.
PT's API can only read points, so this drives the Wizard's window: not on macOS.
- points: [{"path": ["SW1", "Ports", "FastEthernet0/1", "Access VLAN"], "points": 5}].
Every path must be checked already (pt_activity_mark).
Reply: set, not_reached, not_applied (read back from PT) and total_points.pt_activity_resettool Resets the open activity to its initial network, as a student's Reset does.Filesoutside text
Resets the open activity to its initial network, as a student's Reset does.
pt_activity_savetool Saves the activity as a .pka, with the Wizard open or not, and verifies theFilesoutside text
Saves the activity as a .pka, with the Wizard open or not, and verifies the
file on disk. Marks and rubric count only after reopening it.
Parameters:
- path: full path (the folder must exist) or a name for PT's save folder.
- overwrite: replace an existing file.pt_activity_set_instructionstool Writes the HTML of the first instruction page, with the Wizard open.Filesoutside text
Writes the HTML of the first instruction page, with the Wizard open.
Goes through Import Page (a temporary file and PT's file dialog), the only
way PT keeps the HTML, and reads it back with getInstructionSource(0).
Reply: html_preserved, identical (apart from whitespace).pt_activity_statustool State of the open activity: whether it is one, password confirmed, items,Filesoutside text
State of the open activity: whether it is one, password confirmed, items,
correct items, points, percentage, time, instructions as text, feedback.
A password-protected activity replies locked=true. Counters are stale after
opening until the network changes (pt_activity_check(refresh=True)).pt_activity_treetool Children of a node of the assessment tree, to find what pt_activity_mark takes.Filesoutside text
Children of a node of the assessment tree, to find what pt_activity_mark takes.
Parameters:
- path: steps from the top, e.g. ["R1", "Ports", "GigabitEthernet0/0"].
Empty = the top level (devices, ConnectivityTests...).pt_add_devicetool Add a single device to Packet Tracer with validation.
Add a single device to Packet Tracer with validation.
Checks: name not empty, model exists in catalog, no duplicate name.
Parameters:
- name: device name (e.g. "R1", "SW-Core", "PC-Admin")
- model: PT model type (e.g. "2911", "2960-24TT", "PC-PT", "Server-PT")
- x: X coordinate on canvas (default 200)
- y: Y coordinate on canvas (default 200)pt_add_linktool Create a link between two devices in Packet Tracer with full validation.
Create a link between two devices in Packet Tracer with full validation.
Checks: both devices exist, both ports exist, ports are free, cable type is valid.
If cable_type is omitted, it is inferred from the device categories.
Parameters:
- device1: first device name
- port1: port on device1 (e.g. "GigabitEthernet0/0", "FastEthernet0/1")
- device2: second device name
- port2: port on device2
- cable_type: cable type (straight, cross, serial, fiber, console, roll, auto, etc.)
Common aliases accepted: "crossover"→"cross", "rollover"→"roll"pt_add_moduletool Installs an expansion module on a device in the active topology.
Installs an expansion module on a device in the active topology.
PT powers the device off, installs the module and powers it back on (with
skipBoot). A restart reloads the startup-config, so routers/switches are saved
first (write memory); the reply says whether the device restarted and was saved.
Parameters:
- device_name: exact device name in PT (e.g. "R1"). Use
pt_query_topology to list valid names.
- slot: the slot identifier as a STRING. The format depends on the
device's slot type:
* HWIC on 2911/2901 → "0/0".."0/3" · on 1941 ONLY "0/0" and "0/1"
(verified against PT 9.0.1: the 1941 has 2 slots, not 4)
(chassis-slot/hwic-subslot)
* NM on 2811/2620XM/Router-PT → "1"
* NIM on ISR4321/4331 → "0/1", "0/2" (chassis/subslot — NOT "0"/"1")
* Cloud-PT/Server-PT/PCs → "0", "1", ... depending on the available slot
An integer is accepted too and converted to a string.
- module_name: exact module name, e.g. "HWIC-2T", "NM-4A/S",
"NIM-2T", "HWIC-1GE-SFP". Use pt_list_modules to discover them.
- dry_run: if True, validates and returns the JS payload without sending it.
Example: add 2 serial ports to R1 in HWIC slot 0:
pt_add_module(device_name="R1", slot="0/0", module_name="HWIC-2T")pt_add_notetool Writes a text note on PT's canvas.
Writes a text note on PT's canvas.
Use it to document the topology on the diagram itself: label a
subnet, mark an OSPF area, name a trunk link. Returns the note's
id, which can be used to delete it later.
The coordinates are the same logical-canvas ones that pt_add_device
and pt_move_device use: routers ~y=100, switches ~y=250, hosts ~y=400.
The font size is NOT configurable: PT fixes it and uses that parameter
for the stacking order, which the tool computes by itself.
Parameters:
- x, y: position on the canvas.
- text: the note's content.
Example: pt_add_note(x=300, y=100, text="LAN 192.168.0.0/24")pt_apply_acltool Applies an ACL to a router in PT's active topology: validates (ranges, types,Filesoutside text
Applies an ACL to a router in PT's active topology: validates (ranges, types,
IPs/wildcards, unreachable rules), checks router/interface against PT, generates IOS CLI and
sends it through configureIosDevice.
- router: device name in PT (see pt_query_topology).
- name_or_number: 1-99/1300-1999 standard, 100-199/2000-2699 extended, any word = named ACL.
- acl_type: "standard" (source only) or "extended" (source, destination, protocol, ports).
- entries: list of dicts:
action "permit"|"deny" (required); protocol "ip"|"icmp"|"tcp"|"udp"|... (default "ip");
source "any" | "host A.B.C.D" | "A.B.C.D wildcard" (required); destination (extended);
source_port_op/source_port, dest_port_op/dest_port/dest_port_end (TCP/UDP, e.g. "eq"/80);
icmp_type ("echo", "echo-reply", ...); tcp_flags (["established"]); log (bool); remark.
- binding_interface: apply the ACL to this interface; empty = only define it.
- binding_direction: "in" (default) or "out"; used only with binding_interface.
- dry_run: validate and return the CLI/JS without sending.
Example entry: {"action": "deny", "protocol": "icmp", "source": "192.168.1.0 0.0.0.255",
"destination": "192.168.0.0 0.0.0.255", "icmp_type": "echo"}.
Full example: resource pt://guide, "Tool notes".pt_apply_acl_objecttool Applies an ACL using PT's object API (AclProcess.addAcl/addStatement)Filesoutside text
Applies an ACL using PT's object API (AclProcess.addAcl/addStatement)
instead of CLI through configureIosDevice.
Same input as pt_apply_acl. It is faster (no CLI parsing) and less
prone to raising modal popups that break the bridge if a line goes wrong.
Limitation: binding only works on the catalog's physical ports (e.g.
GigabitEthernet0/0). For sub-interfaces (G0/0/1.20) use pt_apply_acl (CLI),
since port.setAclInID only applies to the base port and not the sub-interface.
Pipeline: validate the plan → generate statements (without the "access-list NAME " prefix)
→ run addAcl + addStatement one by one + optional binding.pt_apply_bgptool Configures BGP on a router through IOS CLI, each line verified (`router bgp`,
Configures BGP on a router through IOS CLI, each line verified (`router bgp`,
`neighbor <ip> remote-as`, `network <net> mask <mask>`). Measured on a 2911 in PT 9.
- router: router name in PT.
- asn: local AS, 1-65535 (4-byte ASNs were not measured).
- neighbors: [{"ip": "10.0.0.2", "remote_as": 65002}]; remote_as == asn is iBGP.
With PT connected, a neighbor off every connected subnet is a warning.
- networks: CIDR list, host bits zero, e.g. ["192.168.1.0/24"]. BGP only advertises
a network that is in the routing table with that exact mask. `show running-config`
prints a classful one without `mask`.
- dry_run: validate and return the CLI/payload without sending.
Example: pt_apply_bgp(router="R1", asn=65001,
neighbors=[{"ip": "10.0.0.2", "remote_as": 65002}], networks=["192.168.1.0/24"])
Check: pt_cli(device="R1", commands=["show ip bgp summary"]).pt_apply_etherchanneltool Bundles switch ports into an EtherChannel (Port-channel<group>) through IOS CLI,
Bundles switch ports into an EtherChannel (Port-channel<group>) through IOS CLI,
each line verified. Measured on a 2960-24TT in PT 9; other models are not verified.
- switch: switch name in PT.
- ports: 2-8 full port names of one speed, e.g. ["FastEthernet0/10", "FastEthernet0/11"].
A contiguous run is sent as `interface range FastEthernet0/10 - 11`.
- group: channel-group number (1-6 on a 2960).
- mode: "active"|"passive" (LACP), "desirable"|"auto" (PAgP) or "on" (static).
At least one side must be active/desirable: passive+passive or auto+auto never forms.
Configure the peer switch the same way (same group mode family, same ports count).
- trunk: True puts Port-channel<group> in `switchport mode trunk`.
- allowed_vlans: trunk only, e.g. [10, 20] (`switchport trunk allowed vlan`).
- dry_run: validate and return the CLI/payload without sending.
Check it with pt_cli(device=switch, commands=["show etherchannel summary"]).
Example: pt_apply_etherchannel(switch="SW1", ports=["FastEthernet0/10",
"FastEthernet0/11"], group=1, mode="active", trunk=True)pt_apply_hardeningtool Hardens a router/switch in the active topology.
Hardens a router/switch in the active topology.
Applies via CLI: hostname, MOTD banner, enable secret, local users, SSH
(domain-name + RSA keys + `ip ssh version`), service password-encryption, and
restricts the vty lines to SSH with local login.
Parameters:
- device: device name in PT.
- hostname: new hostname (optional).
- banner_motd: MOTD banner text (without the '#' character).
- enable_secret: enable password (it is encrypted).
- users: list of {username, secret, privilege?}. Needed for SSH/local login.
- ssh: dict {domain?, modulus?, version?, enable?} to enable SSH. Requires
at least one user. modulus<768 raises a warning.
- service_password_encryption: applies `service password-encryption` (default True).
- dry_run: if True, only validates and returns the CLI/payload.
Example: full hardening of R1 with SSH:
pt_apply_hardening(device="R1", hostname="R1", enable_secret="cisco123",
users=[{"username":"admin","secret":"adminpass","privilege":15}],
ssh={"domain":"lab.local","modulus":1024}, dry_run=True)pt_apply_hsrptool Configures one HSRP group on a router interface through IOS CLI, each line verified
Configures one HSRP group on a router interface through IOS CLI, each line verified
(`standby version`, `standby <g> ip|priority|preempt`). Measured on a 2911 in PT 9.
- router / interface: e.g. "R1", "GigabitEthernet0/0" (pt_query_topology).
- group: 0-4095 with version 2. Both routers use the same group and virtual_ip.
- virtual_ip: the hosts' gateway. With PT connected it must be a free host address
in the interface's live subnet, not the interface's own IP.
- priority: 0-255, default 100; the higher one becomes active.
- preempt: take over again when this router comes back (default True).
- version: 2 (measured). 1 is accepted but NOT verified.
- dry_run: validate and return the CLI/payload without sending.
Example (active router; repeat on R2 with priority=100):
pt_apply_hsrp(router="R1", interface="GigabitEthernet0/0", group=1,
virtual_ip="192.168.1.254", priority=110)
Check: pt_cli(device="R1", commands=["show standby brief"]).pt_apply_interface_tuningtool Tunes the parameters of a router interface in the active topology.
Tunes the parameters of a router interface in the active topology.
Parameters (all optional except router/interface):
- router: router name in PT.
- interface: interface to tune (e.g. "Serial0/0/0", "GigabitEthernet0/0").
- clock_rate: ONLY on Serial interfaces (DCE end). E.g. 64000, 2000000.
Applying clock_rate to a non-serial interface is a validation error.
- bandwidth: bandwidth in kbps (`bandwidth N`).
- ospf_cost / ospf_priority: per-interface OSPF knobs.
- ospf_hello_interval / ospf_dead_interval: OSPF timers. They must
match the neighbour's or the adjacency won't form; the IOS
convention is dead = 4 x hello, and dead <= hello is rejected.
- ospf_md5_key + ospf_md5_key_id: OSPF message-digest authentication
(recommended). The id must match the neighbour's.
- ospf_auth_key: plain-text OSPF authentication. It works, but the
key travels readable across the network — a warning is emitted.
- delay: interface delay (affects the EIGRP metric), in tens of microseconds.
- ospf_network: "point-to-point" (only type PT accepts), for /30 links.
An ASBR's default route is re-originated (PT drops it on the change).
- dry_run: if True, only validates and returns the CLI/payload.
Example: authenticate OSPF with MD5 between R1 and its neighbour:
pt_apply_interface_tuning(router="R1", interface="GigabitEthernet0/0",
ospf_md5_key_id=1, ospf_md5_key="s3cr3t")pt_apply_nattool Applies NAT or PAT to a router in PT's active topology (IOS CLI through the bridge).
Applies NAT or PAT to a router in PT's active topology (IOS CLI through the bridge).
- router: device name in PT (e.g. "R1"; see pt_query_topology).
- mode: "static" (1:1 fixed mapping, e.g. a server reachable from outside),
"dynamic" (pool of public IPs) or "pat" (overload: many hosts share one public IP,
the usual case).
- inside_interface / outside_interface: LAN-side and WAN-side interfaces.
- static_mappings: static only. [{"inside_local": "192.168.1.10", "inside_global": "200.1.1.5"}]
- inside_networks: dynamic/pat. "network wildcard" strings, e.g. ["192.168.1.0 0.0.0.255"]
(not CIDR); emitted as an inline access-list.
- acl_number: ACL number or name for the inside hosts (default "1").
- pool_name, pool_start, pool_end, pool_netmask ("255.255.255.0" form): the public pool
(dynamic, or pat without interface overload).
- use_interface_overload: pat only. True = use outside_interface's IP instead of a pool.
- dry_run: validate and return the payload without sending.
Typical PAT: mode="pat", inside_networks=["192.168.1.0 0.0.0.255"], use_interface_overload=True.
Mode guidance and a full example: resource pt://guide, "Tool notes".pt_apply_netflowtool Configures a NetFlow exporter on a PT device.
Configures a NetFlow exporter on a PT device.
Unlike the rest of the advanced features, NetFlow does NOT go through CLI: it is
configured directly and read back to verify it was applied. If
the name already exists, it is reconfigured instead of duplicated.
The exported FLOWS are not read: no way to read them was measured on PT 9
(the exporter manager has no exporter or monitor count either).
Parameters:
- device: router where the exporter lives.
- name: exporter name (e.g. "COLLECTOR-1").
- destination_ip: the collector's IP. Without it the exporter is inert.
- udp_port: the collector's UDP port (default 2055).
- version: 9 (templates, recommended) or 5 (fixed format).
- source_port: source interface; empty = PT picks it.
- monitors: names of the monitors to associate.
- remove: if True, deletes the exporter `name` instead of creating it.
- dry_run: if True, only validates and returns the payload without touching PT.
Example: export to a collector at 192.168.0.50:
pt_apply_netflow(device="R1", name="COLLECTOR-1", destination_ip="192.168.0.50")pt_apply_port_securitytool Configures port-security on a switch's access port.
Configures port-security on a switch's access port.
Parameters:
- switch: switch name in PT.
- port: access port (e.g. "FastEthernet0/1").
- max_mac: maximum number of allowed MACs (default 1).
- violation: "shutdown" (default) | "restrict" | "protect".
- sticky: if True, learns sticky MACs (`mac-address sticky`).
- static_macs: static MACs in IOS aaaa.bbbb.cccc format.
- dry_run: if True, only validates and returns the CLI/payload.
Example: max 2 sticky MACs on SW1's Fa0/1:
pt_apply_port_security(switch="SW1", port="FastEthernet0/1", max_mac=2, dry_run=True)pt_apply_qostool Configures QoS (MQC) on a router through IOS CLI, each line verified: one
Configures QoS (MQC) on a router through IOS CLI, each line verified: one
`class-map match-any` per class, a `policy-map` whose class-default gets
`fair-queue`, and `service-policy output` on the interface. Measured on a 2911.
- router / interface: e.g. "R1", "GigabitEthernet0/1" (the WAN side).
- policy_name: one word, e.g. "WAN-OUT".
- classes: [{"name", "match_dscp"?, "match_protocol"?, "priority_kbps"|"bandwidth_kbps"}].
At least one match per class (both = match-any); exactly one action.
Measured: match_protocol "rtp", match_dscp "ef", priority_kbps. Other DSCP values,
other protocols and bandwidth_kbps are accepted but NOT verified (warning).
- direction: "output" only (queuing actions are outbound in IOS).
- dry_run: validate and return the CLI/payload without sending.
Example: pt_apply_qos(router="R1", interface="GigabitEthernet0/1", policy_name="WAN-OUT",
classes=[{"name": "VOICE", "match_protocol": "rtp", "match_dscp": "ef",
"priority_kbps": 512}])
Check: pt_read_qos(device="R1").pt_apply_stptool Configures Spanning-Tree on a switch in the active topology.
Configures Spanning-Tree on a switch in the active topology.
Parameters:
- switch: switch name in PT (e.g. "SW1").
- mode: "rapid-pvst" (default) or "pvst".
- root_primary_vlans: list of VLANs where this switch is root primary (generates
`spanning-tree vlan N root primary`).
- priority: dict {vlan_id: priority}. The priority must be 0-61440 and a multiple of 4096.
- portfast_ports: access ports with `spanning-tree portfast`.
- bpduguard_ports: ports with `spanning-tree bpduguard enable`.
- dry_run: if True, only validates and returns the CLI/payload.
Example: SW1 root for VLAN 10 + portfast on Fa0/1:
pt_apply_stp(switch="SW1", root_primary_vlans=[10],
portfast_ports=["FastEthernet0/1"], dry_run=True)pt_apply_vlantool Applies VLANs / trunks / inter-VLAN routing to the active PT topology through IOS CLI:Filesoutside text
Applies VLANs / trunks / inter-VLAN routing to the active PT topology through IOS CLI:
switch side (VLANs, access ports, trunks) and optionally router side (.1q subinterfaces,
router-on-a-stick). Use pt_query_topology for the real names/ports.
- switch: switch name (e.g. "SW1"). router: only for subinterfaces.
- vlans: [{"vlan_id": 10, "name": "SALES"}] (name optional).
- access_ports: [{"switch": "SW1", "port": "FastEthernet0/1", "vlan_id": 10}].
- trunks: [{"switch", "port", "allowed_vlans"?, "native_vlan"?, "encapsulation"?}]. A 2960
(dot1q only) gets no `switchport trunk encapsulation`; a 3560 does.
- subinterfaces: [{"router": "R1", "parent_port": "GigabitEthernet0/0", "vlan_id": 10,
"ip_cidr": "192.168.10.1/24"}].
- dry_run: validate and return the CLI/payload without sending.
Router-on-a-stick example: resource pt://guide, "Tool notes".pt_apply_voicetool Cisco CME voice (IP phones) through IOS CLI, each line verified. The router MUST be
Cisco CME voice (IP phones) through IOS CLI, each line verified. The router MUST be
a 2811 (PT's 2911 rejects `telephony-service` even with the uck9 license).
Measured end to end on PT 9 (2811 + 3560-24PS + two 7960): CME, DHCP option 150
and real registration (`show ephone`: REGISTERED). Not measured: ephone + mac,
switchport voice vlan (the reply warns).
- source_ip: the router's IP on the phones' LAN (checked against PT).
- extensions: ["1001", "1002"] or [{"number": "1001", "mac"?: "0001.4321.ABCD"}].
- max_ephones 1-36, max_dn 1-144. auto_assign: `auto assign 1 to N`.
- voice_vlan + switch + access_ports: `switchport voice vlan` on those ports.
- dhcp_pool: `option 150 ip <source_ip>`; dhcp_network ("10.10.10.0/24") also sets
network + default-router.
- restart_phones: power-cycle every IP phone, then fast-forward (default True);
phones already on keep 0.0.0.0 otherwise.
- dry_run: validate and return the CLI/payload without sending.
Example: pt_apply_voice(router="R1", source_ip="10.10.10.1", extensions=["1001","1002"],
dhcp_pool="VOICE", dhcp_network="10.10.10.0/24")
Check: pt_cli(device="R1", commands=["show ephone"]).pt_audit_securitytool Audits the REAL security posture of the live devices in PT.
Audits the REAL security posture of the live devices in PT.
It does not read the plan: it reads the effective configuration of each router/switch
on the canvas and reports findings with a severity (high/medium/low). Detects
a missing `enable secret`, credentials stored reversibly
(type 7), `service password-encryption` off, no local
users, a missing MOTD banner and config-register at 0x2142 (which discards
the startup-config on the next reboot).
Passwords and hashes NEVER leave the device: only the label of the
algorithm they are stored with is transmitted.
Hosts (PC/Server/Laptop) are skipped: they have no IOS configuration.
Parameters:
- device: if given, audits only that device; empty = all of them.
Example: audit the whole topology:
pt_audit_security()pt_auto_layouttool Rearrange the devices on the canvas by topology and fit them to the visible view.Filesoutside text
Rearrange the devices on the canvas by topology and fit them to the visible view.
Reads the live devices and links: routers form the core (2 or a chain: a row with
the end LANs pointing outward, middle LANs alternating down/up; a ring: a polygon;
a hub: a star), each LAN hangs off its router away from the core (switch, then its
hosts side by side), a WAN cloud takes the free side. Moves everything in one call
and reads each position back.
Use it after building by hand, after adding devices, or when a lab looks crowded.
pt_full_build / pt_plan_topology already plan with this layout.
Parameters:
- apply: False only returns the new positions without moving anything.pt_backup_configtool Backs up a PT device's startup configuration.
Backs up a PT device's startup configuration.
Returns the real startup-config (the one the device rereads on restart),
plus its serial number, config-register, boot images and uptime.
Use it to save a known state before touching something, or to
compare two devices.
Parameters:
- device: name of the router or switch in PT.
- include_xml: if True, adds the device's full XML dump
(topology + config + modules). It is tens of thousands of characters:
useful for archiving, heavy to read.
Example: pt_backup_config(device="R1")pt_bridge_statustool Checks which channel Packet Tracer is connected through.
Checks which channel Packet Tracer is connected through.
There are two: HTTP (when the MCP Control Center window is open) and
file (when it is closed but PT is still open with the extension). With
either one, deployment works.pt_canvas_infotool Size of PT's visible logical view and where the devices are, so you know which
Size of PT's visible logical view and where the devices are, so you know which
x/y range to use before pt_add_device / pt_move_device / pt_add_note.
Returns view [width, height] in canvas px (depends on the screen and the window:
1512x599 on a 14" MacBook, about 1900x700 on a maximised 1920x1080), zoom (0 =
100 %), the device count and their bbox [x0, y0, x1, y1]. x/y of a device is the
top-left corner of its icon (about 50x40 px, labels below): keep x within
[40, width-90] and y within [40, height-90] so everything is visible.pt_clear_annotationstool Removes the canvas annotations: text notes and drawings.
Removes the canvas annotations: text notes and drawings.
It does NOT touch devices or links, only the graphic elements.
PT leaves orphan note ids that it never releases — with no text and that it
refuses to delete. They are not a failure: the canvas is visually clean
anyway, and they are reported separately as `stale_ids`.
Parameters:
- kind: "all" (default) removes notes and drawings; "notes" only the notes.
Example: pt_clear_annotations()pt_clitool Types commands into a router/switch console (CLI tab) and returns eachFilesoutside text
Types commands into a router/switch console (CLI tab) and returns each
one's output. Same as typing in the IOS CLI: enable, configure
terminal, interface..., show ip route, ping, copy run start...
Without taking the screen: it goes through PT's API, and what is typed
shows up in the device's real CLI tab.
Parameters:
- device: exact name (pt_query_topology).
- commands: a list of commands, or a block of text with one per line.
Typed in order, waiting for the prompt between them.
- timeout: maximum seconds per command, up to 300 (ping/traceroute take a while).
When it runs out the command is aborted with Ctrl+Shift+6.
- auto_confirm: presses Enter on "[confirm]" and "Destination filename [..]?".
[yes/no] and Password: questions are NOT answered automatically: put
the answer as the next command (e.g. ["reload", "no", ""]).
- show: True/False opens (or not) the device's window on the CLI tab.
None = per pt_ui_mode.
- capture: saves a PNG of the window when done (implies show).
Each command comes back marked: ok, ERROR (% Invalid input...), UNKNOWN
COMMAND (IOS took it as a hostname: the DNS lookup is aborted), WAITING
FOR ANSWER or TIMEOUT. A freshly created router is primed automatically
(answers 'no' to the initial dialog).pt_clitool
No description.
pt_configure_dhcp_servertool Creates or edits a DHCP pool on a Server-PT (GUI: Services > DHCP), validated against
Creates or edits a DHCP pool on a Server-PT (GUI: Services > DHCP), validated against
its subnet, switches the service on and reads every pool back. No CLI (a Server-PT has none).
Router DHCP: plan with dhcp=True or CLI `ip dhcp pool`. Exclusions or showing the page on
screen: pt_server_dhcp (same JS backend, server_dhcp_js).
The server needs a static IP inside the pool's subnet (else warning DHCP_SERVER_NO_IP). PT
never leases the server's own IP but DOES lease the gateway's if the range covers it.
- device: the Server-PT.
- network / mask: pool subnet ("192.168.10.0", "255.255.255.0"). No network = read-only.
- gateway / dns: what clients receive (empty dns = left alone).
- start_ip: first IP handed out; empty = after a .1 gateway, else the first host.
- max_users: number of IPs; 0 = to the end of the subnet.
- pool_name: default "serverPool" (the factory pool the GUI shows); another name creates or
edits that pool, never duplicates.
- port: serving port (default FastEthernet0). enabled: service On/Off.
- drop_factory_pool: with a custom pool_name, delete the factory serverPool if it was never
configured (it would hand out .1, the gateway).
- remove: delete pool_name instead. dry_run: validate and return the JS only.
Example: pt_configure_dhcp_server(device="DHCP-A", network="192.168.10.0",
gateway="192.168.10.1", dns="8.8.8.8", start_ip="192.168.10.3")pt_delete_devicetool Delete a device from the active topology in Packet Tracer.
Delete a device from the active topology in Packet Tracer.
Uses getLogicalWorkspace().removeDevice() and verifies the device is gone.
Parameters:
- device_name: exact device name (e.g. "R1", "PC3", "Laptop-WAN")pt_delete_linktool Delete the link connected to a specific interface on a device in PT.
Delete the link connected to a specific interface on a device in PT.
Reads both ends back: `verified` is true only when this port AND the
far-end port no longer have a link. Reports the far end and the cable.
Parameters:
- device_name: device name (e.g. "R1")
- interface_name: interface name (e.g. "GigabitEthernet0/0", "FastEthernet0/1")pt_deploytool Deploys a plan to Packet Tracer: copies the script to the WindowsFilesoutside text
Deploys a plan to Packet Tracer: copies the script to the Windows
clipboard, exports the configuration files, and generates
step-by-step instructions.
Usage: after pt_full_build or pt_plan_topology, pass the plan JSON
here to prepare everything for Packet Tracer.
Parameters:
- plan_json: plan JSON (output of pt_plan_topology or pt_full_build)
- project_name: project name
- output_dir: folder inside the MCP's working directory (PT_MCP_WORKDIR);
a path that points elsewhere is reduced to a folder name there.pt_device_powertool Powers a device in PT on or off, with a verification read.
Powers a device in PT on or off, with a verification read.
Useful to simulate equipment failure and see how routing reacts, or
to restart a router so it rereads its startup-config.
Works on every model, PCs included. Hosts have no IOS boot,
so when powering them on `booting` comes back null; on a router
or switch the boot is skipped so as not to wait for the full start-up.
Parameters:
- device: device name in PT.
- on: True powers on (default), False powers off.
Example: simulate R2 going down:
pt_device_power(device="R2", on=False)pt_difftool Compares a plan (JSON from pt_plan_topology) against PT's LIVE topology.
Compares a plan (JSON from pt_plan_topology) against PT's LIVE topology.
Reports: plan devices missing from PT, extra devices in PT,
and per-interface IP mismatches. Useful to reconcile after a deploy.
Requires a connected bridge.pt_email_clienttool A host's Desktop > Email.Filesoutside text
A host's Desktop > Email.
- action="configure": name, address ([email protected]), username, password,
smtp_server, pop3_server (IP or name of the Server running EMAIL).
- action="send": to, subject, body (uses the configured account).
- action="receive": asks the POP3 server for mail (it shows in the
window; PT does not expose the mailbox through the API).
Server accounts are created with pt_server_service(service="email").
The server's Domain Name and SMTP/POP3 switches are set with
pt_server_service(server, "email", domain=..., smtp=..., pop3=...).pt_estimate_plantool Quick estimate (dry-run) without generating a full plan.
Quick estimate (dry-run) without generating a full plan.
Shows how many devices, links and subnets will be created.
Parameters:
- routers: Number of routers (1-20)
- pcs_per_lan: PCs per LAN
- laptops_per_lan: Laptops per LAN (Laptop-PT)
- switches_per_router: Switches per router
- servers: Servers
- access_points: Access Points (AccessPoint-PT)
- has_wan: Include WAN
- dhcp: Configure DHCP
- routing: static, ospf, eigrp, rip, nonept_explain_plantool Explains the plan's decisions in natural language.Filesoutside text
Explains the plan's decisions in natural language.
Useful to understand why certain models, IPs, etc. were chosen.
Parameters:
- plan_json: plan JSONpt_exporttool Exports the plan to files: JS script, CLI configs and JSON.Filesoutside text
Exports the plan to files: JS script, CLI configs and JSON.
Parameters:
- plan_json: plan JSON
- project_name: project name
- output_dir: folder inside the MCP's working directory (PT_MCP_WORKDIR);
a path that points elsewhere is reduced to a folder name there.pt_export_topologytool Export a detailed snapshot of the full topology currently in Packet Tracer.
Export a detailed snapshot of the full topology currently in Packet Tracer.
Returns devices (name, model, x/y position, interfaces with IPs) and links
(endpoints, ports, and the REAL cable type PT reports for each link:
straight, cross, serial, fiber...). This gives a complete picture of
what is deployed so the LLM can reason about the topology.pt_fast_forwardtool Realtime's "Fast Forward Time" button: moves PT's clock ahead at once.FilesEnv varsoutside text
Realtime's "Fast Forward Time" button: moves PT's clock ahead at once.
Use it after cabling or changing switch links: STP needs ~30 s to put a
new port in forwarding, and fast-forwarding gets there immediately, so a
ping right after it works (measured on PT 9.0). Realtime only (in
Simulation use pt_simulation_step). The network is not reset.
pt_live_deploy and pt_verify_connectivity already do this themselves.pt_fix_plantool Tries to fix the plan's errors automatically.Filesoutside text
Tries to fix the plan's errors automatically.
Fixes cables, upgrades routers that lack ports, reassigns ports.
Parameters:
- plan_json: JSON of the plan to fixpt_generate_configstool Generates the CLI (IOS) configurations for every router and switch.Filesoutside text
Generates the CLI (IOS) configurations for every router and switch.
Parameters:
- plan_json: plan JSONpt_generate_scripttool Generates the PTBuilder JavaScript script.Filesoutside text
Generates the PTBuilder JavaScript script.
Parameters:
- plan_json: plan JSON
- include_configs: if True, includes the CLI configs as commentspt_get_device_detailstool Shows the details of a specific device model.
Shows the details of a specific device model.
Accepts either the exact model name (e.g. '2911', '2960-24TT')
or a catalog alias (e.g. 'router', 'switch', 'firewall').
Parameters:
- model_name: model name or aliaspt_health_checktool Health sweep of PT's LIVE topology.
Health sweep of PT's LIVE topology.
Reports: down links (cabled but not up), cabled ports without an IP
(possibly an unfinished DHCP), and duplicate IPs. Requires a connected bridge.pt_host_commandtool Runs a command in a PC/Laptop/Server's Desktop > Command PromptFilesoutside text
Runs a command in a PC/Laptop/Server's Desktop > Command Prompt
(ping, ipconfig, ipconfig /all, ipconfig /renew, tracert, arp -a,
nslookup, netstat, telnet, ssh -l user ip, ftp...) and returns the output.
Parameters:
- device: the host's name.
- command: the line to run (e.g. "ping 192.168.1.1").
- inputs: answers to whatever the command asks afterwards, in order
(e.g. a telnet/ssh password, then commands for the remote device).
- timeout: maximum seconds per line, up to 300 (a failing ping takes ~15 s).
- show / capture / output_dir: as in pt_cli; opens Desktop > Command Prompt.pt_host_firewalltool A host's Desktop > Firewall / IPv6 Firewall: switches the inboundFilesoutside text
A host's Desktop > Firewall / IPv6 Firewall: switches the inbound
firewall on or off (True/False; None = leave alone). Individual rules
have no API in PT; edit them in the window
(pt_ui_open(host, app="firewall")).pt_host_ip_configtool Desktop > IP Configuration (and Config > Global) of a PC/Laptop/Server:Filesoutside text
Desktop > IP Configuration (and Config > Global) of a PC/Laptop/Server:
static IP or DHCP, mask, gateway, DNS, IPv6 (automatic or static).
Parameters (empty = leave alone):
- mode: "static" | "dhcp". With "dhcp" a lease is requested and the
tool waits up to wait_dhcp_s seconds (0-120) for it.
- ip, mask: IPv4 and mask ("255.255.255.0" or "24").
- gateway, dns: IPv4. "0.0.0.0" to clear.
- interface: port (default: the first Ethernet, or Wireless0).
- ipv6_mode: "auto" (SLAAC) | "off".
- ipv6_address: static IPv6 with its prefix, "2001:db8:0:1::10/64".
Added to the port (it does not remove other addresses) and read back.
- ipv6_gateway, ipv6_dns.
- show / capture: opens Desktop > IP Configuration (per pt_ui_mode).
For routers/switches use pt_cli (ip address ... on the interface).pt_inspect_portstool Real state of each port of a live device in PT.
Real state of each port of a live device in PT.
Reads the device, not the plan: line/protocol status, MAC, IP/mask,
duplex, bandwidth, MTU, delay, CDP, DHCP client, NAT mode, applied
ACLs and, on a cabled port, the real cable type (straight, cross,
serial...) and the far end ("SW1:FastEthernet0/1"). Flags anomalies (cable connected with the port down, line up with
protocol down).
It is the DETAIL view of one device; for the sweep of the whole
topology (down links, duplicate IPs) use pt_health_check.
Parameters:
- device: device name; empty = all (verbose on large topologies).
- only_linked: if True, returns only ports with a cable connected.
Example: see why one of R1's links won't come up:
pt_inspect_ports(device="R1", only_linked=True)pt_install_modules_batchtool Installs N modules in a single runCode JS — save → power-off → addModule×N → power-on.Filesoutside text
Installs N modules in a single runCode JS — save → power-off → addModule×N → power-on.
Useful when several serial modules (HWIC-2T, NIM-2T, etc.) have to go into
several routers at once. PREFER this tool over multiple calls to
pt_add_module: each individual power cycle can pause PT's script engine
for > 5s and kill the bridge bootstrap's polling.
Parameters:
- modules: list of dicts with {device, slot, module}. Example for RTR-4 with
4 serial ports on a 2911 (which does NOT accept NM-4A/S):
[
{"device": "RTR-4", "slot": "0/0", "module": "HWIC-2T"},
{"device": "RTR-4", "slot": "0/1", "module": "HWIC-2T"}
]
→ gives Serial0/0/0..0/0/1, Serial0/1/0..0/1/1.
- dry_run: if True, validates and returns the JS payload without sending it.
Slot rules (string):
HWIC on 2911/2901 → "0/0".."0/3" · on 1941 ONLY "0/0" and "0/1"
NIM on ISR4321/4331 → "0/1", "0/2" (chassis/subslot — NOT "0"/"1")
NM on 2811/Router-PT → "1"
Cloud-PT / hosts → "0".."7"
Returns JSON with summary and per-module status (installed or not).
The JS (js_payload) is only included with dry_run; once sent it is dropped.pt_list_devicestool Lists every device available in Packet Tracer with its ports.
Lists every device available in Packet Tracer with its ports.
Use this to know which models, ports and cables you can use.pt_list_modulestool Lists the expansion modules available in the PT catalog.
Lists the expansion modules available in the PT catalog.
Without filters it returns ALL modules. Useful to find the exact
names before calling pt_add_module.
Parameters:
- router_model: if given (e.g. "2911", "ISR4321"), filters to
modules compatible with that router. Includes generic modules
(no compatible_with list) and the ones that list that model.
- category: filters by category (e.g. "router_hwic", "router_nm",
"router_nim", "router_wic"). Empty = all.
Returns JSON with: name, description, category, ports_added,
compatible_with.pt_list_projectstool Lists the saved projects.Filesoutside text
Lists the saved projects.
Parameters:
- output_dir: projects folder inside the MCP's working directory (PT_MCP_WORKDIR)pt_list_templatestool Lists every available topology template with its description.
Lists every available topology template with its description.
pt_load_projecttool Loads a saved project.Filesoutside text
Loads a saved project.
Parameters:
- project_name: project name
- output_dir: projects folder inside the MCP's working directory (PT_MCP_WORKDIR)pt_move_devicetool Move a device to new coordinates on the Packet Tracer canvas.
Move a device to new coordinates on the Packet Tracer canvas.
Reads the position back: `verified` is true when PT reports exactly (x, y).
Parameters:
- device_name: device name
- x: X coordinate (logical view, e.g. 100-800)
- y: Y coordinate (logical view, e.g. 100-600)pt_open_projecttool Opens a .pkt file in Packet Tracer.Filesoutside text
Opens a .pkt file in Packet Tracer.
WARNING: it replaces the topology currently open. If it has unsaved
changes, save them first with pt_save_project.
Parameters:
- path: full path to an existing .pkt file (any folder: opening the
user's own labs is the point). A relative path is looked up inside the
MCP's working directory and may not leave it.pt_plan_topologytool Generates a complete network topology plan for Packet Tracer.FilesEnv varsoutside text
Generates a complete network topology plan for Packet Tracer.
Parameters:
- routers: Number of routers (1-20)
- pcs_per_lan: PCs per LAN
- laptops_per_lan: Laptops per LAN (Laptop-PT)
- switches_per_router: Switches per router (0-4)
- servers: Number of servers
- access_points: Number of Access Points (AccessPoint-PT), one per LAN
- has_wan: Include a WAN connection (Cloud)
- dhcp: Configure DHCP automatically
- routing: Routing protocol (static, ospf, eigrp, rip, none)
- router_model: Router model (1941, 2901, 2911, ISR4321; 2811 for CME voice)
- switch_model: Switch model (2960-24TT, 3560-24PS)
- template: Template (single_lan, multi_lan, multi_lan_wan, star, hub_spoke,
branch_office, router_on_a_stick, three_router_triangle, custom)
- floating_routes: If True with routing=static, adds backup routes with AD=254
over alternative paths (needs a topology with multiple paths)
- ospf_process_id: OSPF process ID (1-65535, default 1)
- eigrp_as: EIGRP AS number (1-65535, default 100)
- vlans: router_on_a_stick template only. Number of VLANs to spread across the PCs (0 = default 2).
- dual_stack: If True, adds IPv6 addressing (routers via CLI, hosts via SLAAC).
- ipv6_base: Base IPv6 prefix for dual-stack (default "2001:db8::/32").
- wireless_laptops: If True, laptops connect over WiFi (wireless NIC + an AP
auto-associated per LAN) instead of a cable.
Returns the full plan JSON.pt_project_metadatatool Reads (and optionally writes) the metadata of the project open in PT.
Reads (and optionally writes) the metadata of the project open in PT.
Returns the saved file, the PT version that wrote it and the
project description, together with the device and link counts.
Useful to know what you are working with before changing anything.
Parameters:
- description: if given, REPLACES the project description.
Empty = read only.
Example: pt_project_metadata()pt_query_topologytool Query current devices in Packet Tracer.
Query current devices in Packet Tracer.
Returns name, model, and port/IP info for each device in the active topology,
then every link with its real cable type (read from the link itself).
Requires bridge connected (use pt_bridge_status to verify).pt_read_acltool Reads the REAL ACLs of a router: each ACL with its commands, and which
Reads the REAL ACLs of a router: each ACL with its commands, and which
ports have an ACL applied in which direction.
Flags ports that reference an ACL that does not exist. Use it to check
a pt_apply_acl.
Parameters:
- device: router name; empty = every device with ACLs.
Example: pt_read_acl(device="R1")pt_read_arptool Reads the REAL ARP table (IP -> MAC -> port) of a device, router or host.
Reads the REAL ARP table (IP -> MAC -> port) of a device, router or host.
Parameters:
- device: device name; empty = every device.
Example: did PC1 resolve its gateway? pt_read_arp(device="PC1")pt_read_cdptool Reads the REAL CDP neighbour table: who is cabled to which port.
Reads the REAL CDP neighbour table: who is cabled to which port.
Per neighbour: device id, local and remote port, platform, capability.
CDP announces every 60 s: right after a deploy the table is empty.
Parameters:
- device: device name; empty = every device.
Example: pt_read_cdp(device="SW1")pt_read_device_paneltool Reads what a device's tabs show, in one go (read-only): model, power,
Reads what a device's tabs show, in one go (read-only): model, power,
whether it is a host, DHCP, the host's default gateway, per port IP/mask/MAC/state/IPv6/firewall/
bandwidth, and on servers which services (DHCP, DNS, HTTP, TFTP, FTP,
SYSLOG, EMAIL, NTP) are on.pt_read_dhcp_leasestool Reads the REAL DHCP leases a server handed out: per pool, each lease's
Reads the REAL DHCP leases a server handed out: per pool, each lease's
IP, MAC, port and lease time.
Router pools (`ip dhcp pool`) come from its DhcpServerProcess (measured
on a 2911); a Server-PT's from each port's DHCP process. A pool whose
leases this PT build cannot read says `lease_api: false`: unknown, not
zero. Use it to check that hosts got their address from the right pool.
Parameters:
- device: router or server name; empty = every DHCP server.
Example: pt_read_dhcp_leases(device="R1")pt_read_mac_tabletool Reads a switch's REAL MAC address table, per VLAN: MAC, port, dynamic or static.
Reads a switch's REAL MAC address table, per VLAN: MAC, port, dynamic or static.
Parameters:
- switch: switch name; empty = every switch.
- vlan: VLAN number; 0 = every VLAN.
Example: where did SW1 learn PC1's MAC? pt_read_mac_table(switch="SW1")pt_read_nattool Reads a router's REAL NAT state: the translation table, NAT counters
Reads a router's REAL NAT state: the translation table, NAT counters
(inside source lists, statics, pools) and inside/outside interfaces.
Flags a router with NAT but without both an inside and an outside
interface. Use it to check a pt_apply_nat.
Parameters:
- device: router name; empty = every router with NAT.
Example: pt_read_nat(device="R1")pt_read_ospftool Reads OSPF's REAL state: router-id, areas and neighbours per process.
Reads OSPF's REAL state: router-id, areas and neighbours per process.
Each neighbour comes with its state by name (FULL, 2WAY, INIT...), its
role (DR/BDR/DROTHER, null on point-to-point), local port and address.
Flags neighbours not FULL (2WAY between DROTHERs is normal), duplicate
router-ids and routers with OSPF but no neighbours.
Parameters:
- device: router name; empty = every router.
Example: pt_read_ospf(device="R1")pt_read_packet_tracetool Reads the simulation's event list: what each packet did and WHY.
Reads the simulation's event list: what each packet did and WHY.
Besides the path (device, ingress/egress port, source,
destination, traffic type and outcome) it returns the decision log that
PT generates per OSI layer — the same text as the "PDU Details" panel of its
GUI. That is where the real cause of a failing ping shows up, for
example: "The next-hop IP address is not in the ARP table."
Requires Simulation mode with generated traffic (pt_simulation_mode(on=True)
and then a ping, or pt_simulation_step so the events move on).
Parameters:
- limit: maximum frames to return (1-200, default 20).
- device: if given, only the frames that went through that device.
- include_decisions: if False, omits the per-layer log (shorter reply).
Example: see why a ping is dropped:
pt_read_packet_trace(limit=10)pt_read_qostool Reads a device's REAL QoS configuration: class-maps and policy-maps.
Reads a device's REAL QoS configuration: class-maps and policy-maps.
Read only (PT's API cannot create class/policy-maps): to CONFIGURE QoS
use pt_apply_qos. This tool checks that it was applied.
Returns, per class-map, its match type and CLI; per policy-map, its
classes in order, each with its name, priority (kbps), bandwidth (kbps),
fair-queue and whether it is class-default. PT does not give a class
its name, so names come from the running-config, matched by position.
Parameters:
- device: router name in PT.
Example: pt_read_qos(device="R1")pt_read_routestool Reads the REAL routing table of a live device (or of every router).
Reads the REAL routing table of a live device (or of every router).
What `show ip route` shows, read from the device's RoutingProcess:
per route its prefix, protocol letter and name (C connected, L local,
S static, O OSPF, D EIGRP, R RIP), next hop, interface, AD and metric.
Across several routers it lists `convergence_gaps`: prefixes a router
running a dynamic protocol lacks while the others know them.
Parameters:
- device: device name; empty = every device with a routing table.
Example: did OSPF converge? pt_read_routes()pt_read_stptool Reads Spanning Tree's REAL state per VLAN: who the root bridge is.
Reads Spanning Tree's REAL state per VLAN: who the root bridge is.
Per switch and VLAN: whether it is the root, the root ID (priority and
MAC), and where available its bridge ID, priority, root path cost and
root port. Across switches it flags VLANs where they disagree on the
root (not converged). PT 9 does not expose per-port STP state or role.
Parameters:
- switch: switch name; empty = every switch.
- vlans: VLAN numbers to read; empty = every VLAN in the switch.
Example: pt_read_stp(vlans=[1, 10])pt_read_vlanstool Reads a switch's REAL VLAN database in PT.
Reads a switch's REAL VLAN database in PT.
Returns each VLAN with its number, name, whether it is one of PT's
factory ones (1, 1002-1005) and its access ports; plus the trunk ports
(with native VLAN), the ports with port security, and access ports left
in a VLAN missing from the database. Use it to confirm that a
pt_apply_vlan was applied, or to discover a topology you didn't build.
Parameters:
- switch: switch name in PT.
Example: pt_read_vlans(switch="SW1")pt_remove_acltool Removes an ACL applied on a router.
Removes an ACL applied on a router.
If binding_interface is given, it first removes the binding from the
interface (no ip access-group ...) and then deletes the whole ACL
(no access-list ...).
Parameters:
- router: device name in PT
- name_or_number: identifier of the ACL to remove
- binding_interface: optional, interface where it was applied
- binding_direction: "in" or "out" (only with binding_interface)
- dry_run: if True, returns the payload without sending itpt_remove_acl_objecttool Removes an ACL using the object API (AclProcess.removeAcl + Port.setAclInID="").
Removes an ACL using the object API (AclProcess.removeAcl + Port.setAclInID="").
Alternative to pt_remove_acl (CLI). If binding_interface is given, it
first clears the port's AclInID/AclOutID and then removes the ACL.
Parameters:
- router: device name in PT
- name_or_number: identifier of the ACL to remove
- binding_interface: optional, interface where the binding was
- binding_direction: "in" or "out" (only with binding_interface)
- dry_run: if True, returns the payload without sending itpt_remove_moduletool Removes the module installed in a slot (Physical tab). Powers the deviceFilesoutside text
Removes the module installed in a slot (Physical tab). Powers the device
off, removes it and powers it back on, like pt_add_module (routers/switches
are saved first with write memory); skipped when PT reports the module as
hot-swappable. The reply says whether it restarted and was saved.
- slot: STRING, same format as pt_add_module ("0/0", "1", "0"...).pt_remove_nattool Removes the NAT/PAT configuration from a router.
Removes the NAT/PAT configuration from a router.
Removes the ip nat inside/outside marks from the interfaces and deletes
the associated translations, pool and access-list.
Parameters:
- router: device name in PT
- mode: "static" | "dynamic" | "pat"
- inside_interface: interface marked as ip nat inside
- outside_interface: interface marked as ip nat outside
- acl_number: number/name of the access-list used (default "1")
- pool_name: name of the NAT pool to remove (only dynamic/pat with a pool)
- static_mappings: mode="static" only. List of dicts with inside_local/inside_global
to generate the "no ip nat inside source static ..." commands
- dry_run: if True, returns the payload without sending itpt_rename_devicetool Rename a device in the active Packet Tracer topology.
Rename a device in the active Packet Tracer topology.
Reads the result back: `verified` is true only when the new name resolves
to the device and the old name no longer does.
Parameters:
- old_name: current device name
- new_name: new name to assignpt_save_projecttool Saves Packet Tracer's active topology as a .pkt file.Filesoutside text
Saves Packet Tracer's active topology as a .pkt file.
Closes the loop: until now the MCP built the topology but saving it
needed Ctrl+S by hand.
Parameters:
- filename: file name (.pkt is added if missing)
- directory: destination folder. Empty = PT's save folder (on Linux, where PT
reports a folder that does not exist, ~/pt/saves). An absolute
path must be an existing folder (the user's choice of where labs live);
a relative one is a folder inside the MCP's working directory.
- overwrite: replace an existing file (default False: an existing file is an error).pt_screenshottool Captures PT's logical canvas and saves it as an image.Filesoutside text
Captures PT's logical canvas and saves it as an image.
Returns the file's PATH, not the image: a capture weighs tens of
thousands of bytes and dumping it in the reply would fill the context without
anyone being able to see it.
PNG compresses a diagram much better than JPG (measured: 33 KB versus
105 KB for the same canvas), so it is the default.
Parameters:
- filename: file name, without extension. It is sanitised.
- fmt: PNG (default) | JPG | JPEG | BMP.
- output_dir: destination folder, relative to the project root.
Example: pt_screenshot(filename="lab-ospf")pt_send_pdutool The GUI's "Add Simple PDU": an ICMP echo from one device to another.
The GUI's "Add Simple PDU": an ICMP echo from one device to another.
Parameters:
- source, destination: device names (pt_query_topology).
- simulation: True (default) switches PT to Simulation first, so the
PDU waits in the event list; False switches to Realtime, where PT
delivers it at once.
- steps: in Simulation, how many events to step forward right away
(0-100). With steps > 0 the reply includes the packet trace (path,
drops and PT's per-layer reason), like pt_read_packet_trace.
The first PDU between two devices can die at a router waiting on ARP,
exactly like the first ping: send it again.
Example: pt_send_pdu("PC1", "PC4", steps=10)pt_send_rawtool Send arbitrary JavaScript to Packet Tracer via bridge.
Send arbitrary JavaScript to Packet Tracer via bridge.
Useful for exploring the IPC API or running custom commands.
If wait_result=True, reportResult() is auto-injected into scope.
Just call reportResult(data) in your code — no need to define it.
Examples:
pt_send_raw("reportResult(getDevices('router'))", wait_result=True)
pt_send_raw("addDevice('TestR','2911',500,300)")
Parameters:
- js_code: JavaScript to execute in PT's Script Engine
- wait_result: if True, waits for a response via reportResult()
Refused: activity password material (getHashedPassword,
getChallengeKeyAsBase64, getChallengeKeyAsInts) and reading the bytes
of a .pka/.pkt.pt_server_dhcptool A Server-PT's Services > DHCP: creates or edits a pool and switches it on.Filesoutside text
A Server-PT's Services > DHCP: creates or edits a pool and switches it on.
- pool: name ("serverPool" is the factory one: editing it is the most
common case). Touched only if a pool field below is given; if it
doesn't exist it is created with those values.
- gateway, dns, start_ip, mask ("255.255.255.0" or "24"), max_users,
tftp, wlc: empty/0 = leave alone. PT's script API has no TFTP/WLC
setter, so tftp/wlc always come back in not_applied (set them in the GUI).
Every field is read back: any PT does not hold comes back in
not_applied, with ok=false.
- enable: True = Service On (default), False = Off, None = leave alone.
- remove_pool: deletes that pool (alone, it creates nothing).
- exclude: ranges to exclude, ["192.168.1.1-192.168.1.9"]; they apply
to the port's DHCP server, never create or edit a pool.
- interface: the server's port (default: the first one).
Hosts use it with pt_host_ip_config(mode="dhcp").pt_server_dnstool A Server-PT's Services > DNS: adds/removes records and switches the service on.Filesoutside text
A Server-PT's Services > DNS: adds/removes records and switches the service on.
- records: [{"name": "www.lab.com", "type": "A", "value": "192.168.1.20"},
{"name": "web.lab.com", "type": "CNAME", "value": "www.lab.com"}]
- remove: same shape, to delete.
- enable: True = On (default), False = Off, None = leave alone.
The reply's `stored` says whether each added record is in the server's
database. Check resolution with pt_host_command(host, "nslookup www.lab.com").pt_server_httptool A Server-PT's Services > HTTP: switches HTTP/HTTPS and edits pages.Filesoutside text
A Server-PT's Services > HTTP: switches HTTP/HTTPS and edits pages.
- pages: {"index.html": "<html>...</html>"} replaces the content of
pages that ALREADY exist on the server (a Server-PT has index.html).
New pages cannot be created: PT 9.0.0 answers "File not exist"
(9.0.1 unverified). Such a page comes back in not_applied with
ok=false; the other pages and switches are still applied.
- enable / https_enable: True/False/None (None = leave alone);
enable defaults to True.
- PT 9.0.0 hangs and crashes if one call turns HTTP/HTTPS on or writes
pages while both are off, so such a call changes nothing and returns
ok=false: turn one on in the server's Services > HTTP tab first.
Turning things off is always allowed.
Check it with pt_web_browser(host, "http://<server ip>").pt_server_servicetool A Server-PT's Services > TFTP / FTP / SYSLOG / EMAIL.Filesoutside text
A Server-PT's Services > TFTP / FTP / SYSLOG / EMAIL.
- service: "tftp" | "ftp" | "syslog" | "email"
- enable: True/False (None = leave alone). On EMAIL it switches SMTP
and POP3 together.
- domain, smtp, pop3: EMAIL only. The Domain Name ("lab.com"; empty =
leave alone) and each protocol On/Off; all three are read back.
- users: accounts for ftp/email:
[{"username": "alice", "password": "secret", "permissions": "RWDNL"}]
(permissions FTP only: Read Write Delete reName List).
SYSLOG also returns how many messages it received (`entries`) and the
newest 200 as PT serializes them (`messages`; fields not mapped).pt_set_porttool Sets low-level attributes of a port on a live device in PT.
Sets low-level attributes of a port on a live device in PT.
Only applies the attributes passed explicitly (parameters with
sentinel defaults). Useful for adjustments the CLI doesn't expose easily, or
that you want to apply without entering `configure terminal`.
Parameters:
- device: device name in PT (e.g. "R1")
- interface: interface name (e.g. "GigabitEthernet0/0")
- bandwidth: bandwidth in kbps (>0 to apply; 0 = don't change)
- bandwidth_auto: 1 enables BW auto-negotiation, 0 disables it, -1 doesn't change
- full_duplex: 1 full duplex, 0 half duplex, -1 doesn't change
- duplex_auto: 1 enables duplex auto-negotiation, 0 disables, -1 doesn't change
- description: descriptive text (empty = doesn't change)
- mac_address: MAC in "AABB.CCDD.EEFF" format (empty = doesn't change)
- power: 1 powers the port on, 0 off, -1 doesn't change
- zone_member: name of the port's security zone, for Zone-Based
Firewall (empty = doesn't change). Router interfaces only.
- proxy_arp: 1 enables Proxy ARP, 0 disables it, -1 doesn't change. Turning it off
is common hardening: with Proxy ARP the router answers ARPs that are not
its own and leaks information about the topology.
- ike: 1 enables IKE on the interface (IPsec VPN), 0 disables it,
-1 doesn't change.
Returns which attributes were applied (those with a method available in
the port's API). If some `setXxx` does not exist on the device's model,
it is silently ignored and only what took effect is reported.pt_simulation_modetool Switches PT between Realtime and Simulation mode.
Switches PT between Realtime and Simulation mode.
In Simulation mode packets do NOT move on their own: they stay queued in the
event list and have to be moved with pt_simulation_step. That is what
allows reading the path packet by packet with pt_read_packet_trace.
Parameters:
- on: True enters Simulation (default), False goes back to Realtime.
Example: pt_simulation_mode(on=True)pt_simulation_steptool Steps the simulation forward, back, or resets it.
Steps the simulation forward, back, or resets it.
Requires Simulation mode (pt_simulation_mode(on=True)). Each
step moves the packets one event; after stepping, read the result
with pt_read_packet_trace.
Parameters:
- action: "forward" (default) | "back" | "reset".
- times: how many steps to take (1-100, ignored for "reset").
Example: step 5 events forward:
pt_simulation_step(action="forward", times=5)pt_terminaltool Desktop > Terminal of a PC connected by a CONSOLE cable (RS 232) to aFilesoutside text
Desktop > Terminal of a PC connected by a CONSOLE cable (RS 232) to a
router/switch: types on that device's console, as from the PC's
Terminal. This is how labs configure a device "over the console".
- device: the PC (or Laptop) that has the console cable.
- commands, timeout, auto_confirm: as in pt_cli.
- show/capture: shows the PC's Terminal app (its 9600 8N1 settings
window is accepted automatically).pt_ui_capturetool Saves a PNG of a device's window as it looks in PT (or of the mainFilesoutside text
Saves a PNG of a device's window as it looks in PT (or of the main
window if device is empty). Works even when the window is covered.
Returns the file's PATH, not the image.
Open the tab/app you want first with pt_ui_open (or show=True on the
tool you ran). For the logical canvas without the interface there is
pt_screenshot.pt_ui_closetool Closes a device's window in PT, or all of them if device is empty.
Closes a device's window in PT, or all of them if device is empty.
pt_ui_modetool Headless vs UI: decides whether the device-panel tools also SHOW whatFilesoutside text
Headless vs UI: decides whether the device-panel tools also SHOW what
they do in Packet Tracer's window.
- "headless" (default): everything through the API, no window opens.
- "ui": pt_cli, pt_host_command, pt_host_ip_config, pt_server_*... open
the device's window on the matching tab/app (CLI, Desktop > Command
Prompt, Desktop > IP Configuration, Services > DHCP...) so it can be
watched or captured.
- "status": shows the current mode.
The mode is saved and survives server restarts. Every tool also accepts
show=True/False for a single call. Use it when the user says "show it
in PT", "I want screenshots", "use the tabs" (→ "ui") or "do it in the
background" (→ "headless").pt_ui_opentool Opens a device's window in PT on a tab/app/section, without moving theFilesoutside text
Opens a device's window in PT on a tab/app/section, without moving the
mouse or typing (UI Automation + PT's API).
- tab: Physical | Config | CLI | Desktop | Services | Programming | Attributes
- app (Desktop): ip_configuration, command_prompt, terminal, web_browser,
pc_wireless, email, text_editor, firewall, ipv6_firewall, vpn,
traffic_generator, mib_browser, pppoe_dialer, dial_up, ip_communicator,
tftp, ssh_client, bluetooth, iot_monitor... (implies tab=Desktop)
- section: an entry in the tab's left-hand list: in Config "Settings"
or an interface ("FastEthernet0"); in Services "DHCP", "DNS", "HTTP",
"TFTP", "EMAIL", "FTP"...
Works in headless mode too: it is an explicit request to show.
Requires Windows and the [ui] extra (comtypes).pt_verify_connectivitytool Runs a REAL ping from a device in PT and returns the result.FilesEnv varsoutside text
Runs a REAL ping from a device in PT and returns the result.
Unlike validations that are only printed as "check it by
hand", this runs `ping` on the device's console and parses the real
output: how many packets arrived. Use it to confirm that a freshly
deployed topology really has connectivity.
Works with hosts (PC/Server/Laptop, format "Packets: Sent=..") and with
IOS devices (router/switch, format "Success rate is N percent").
Parameters:
- from_device: name of the device the ping starts from
- to_ip: destination IP
- count: reserved; PT uses its default per type (PC 4, IOS 5). A "-n"
flag would break on IOS, so it is not forced for now.
- timeout_s: maximum wait (default 45s: on a topology deployed moments
ago, switch ports spend ~30s in STP before forwarding). A FAILED ping takes longer
than a successful one: each packet waits for its own timeout before
being declared lost (~13s measured for 4 lost packets).pt_web_browsertool A host's Desktop > Web Browser: opens a URL (http://IP, http://nameFilesoutside text
A host's Desktop > Web Browser: opens a URL (http://IP, http://name
with DNS, https://...) and returns the text of the page it received.
If the browser still shows its previous page (failed or slow load),
the reply is ok=false with a warning, not that old page; re-opening
the URL it last loaded returns the page again. timeout: up to 120 s.
In UI mode (or show=True) the window's own browser does the
navigation, so the capture shows the rendered page.pt_wireless_aptool An access point's wireless settings (AccessPoint-PT Config > Port 1),
An access point's wireless settings (AccessPoint-PT Config > Port 1),
applied and read back. With no settings it only reads.
Parameters (empty/None = leave alone):
- ssid: network name (up to 32 bytes). Clients on another SSID drop
off; giving each AP its own SSID keeps clients off the APs you rename.
- broadcast: SSID broadcast on/off.
- mac_filter: MAC filtering on/off.
- allow_listed: True = only listed MACs may associate, False = listed
MACs are denied.
- mac_list: REPLACES the filter list ("0001.63BE.8468", "00:01:63:BE:84:68").
- reset_associations: after a change, drop every client so they
re-associate against the new settings (default True; without it,
clients already associated may keep the old association).
- dry_run: only read and report what would change.
A dropped client's port still reads up/linked: confirm with a ping
(pt_host_command) or its address, not the port state. WPA/WEP are not
settable: clients need a matching profile, and PT's client profile API
is broken.pt_workspace_optionstool Reads and adjusts PT workspace options that affect how it behaves.
Reads and adjusts PT workspace options that affect how it behaves.
Without arguments it is read-only. The flags are tri-state: 1 enables,
0 disables, -1 (default) leaves alone.
Parameters:
- auto_cabling: PT's auto-cabling picks the cable and the port for you.
Turn it off before building topologies by script if you want exact
control over which port is used.
- external_network_access: lets PT reach the machine's REAL
network. Off by default; turning it on takes traffic out of the simulator.
- show_port_labels / show_link_lights / show_device_labels: what is shown on
the canvas. It matters for a capture to be readable.
Example: turn auto-cabling off before a scripted deploy:
pt_workspace_options(auto_cabling=0)Text the model reads (124)
Every tool, prompt and resource description as written in the code: the model sees all of it, the user usually does not.
pt_web_browser tool
A host's Desktop > Web Browser: opens a URL (http://IP, http://name
with DNS, https://...) and returns the text of the page it received.
If the browser still shows its previous page (failed or slow load),
the reply is ok=false with a warning, not that old page; re-opening
the URL it last loaded returns the page again. timeout: up to 120 s.
In UI mode (or show=True) the window's own browser does the
navigation, so the capture shows the rendered page.pt_server_dhcp tool
A Server-PT's Services > DHCP: creates or edits a pool and switches it on.
- pool: name ("serverPool" is the factory one: editing it is the most
common case). Touched only if a pool field below is given; if it
doesn't exist it is created with those values.
- gateway, dns, start_ip, mask ("255.255.255.0" or "24"), max_users,
tftp, wlc: empty/0 = leave alone. PT's script API has no TFTP/WLC
setter, so tftp/wlc always come back in not_applied (set them in the GUI).
Every field is read back: any PT does not hold comes back in
not_applied, with ok=false.
- enable: True = Service On (default), False = Off, None = leave alone.
- remove_pool: deletes that pool (alone, it creates nothing).
- exclude: ranges to exclude, ["192.168.1.1-192.168.1.9"]; they apply
to the port's DHCP server, never create or edit a pool.
- interface: the server's port (default: the first one).
Hosts use it with pt_host_ip_config(mode="dhcp").pt_server_dns tool
A Server-PT's Services > DNS: adds/removes records and switches the service on.
- records: [{"name": "www.lab.com", "type": "A", "value": "192.168.1.20"},
{"name": "web.lab.com", "type": "CNAME", "value": "www.lab.com"}]
- remove: same shape, to delete.
- enable: True = On (default), False = Off, None = leave alone.
The reply's `stored` says whether each added record is in the server's
database. Check resolution with pt_host_command(host, "nslookup www.lab.com").pt_server_http tool
A Server-PT's Services > HTTP: switches HTTP/HTTPS and edits pages.
- pages: {"index.html": "<html>...</html>"} replaces the content of
pages that ALREADY exist on the server (a Server-PT has index.html).
New pages cannot be created: PT 9.0.0 answers "File not exist"
(9.0.1 unverified). Such a page comes back in not_applied with
ok=false; the other pages and switches are still applied.
- enable / https_enable: True/False/None (None = leave alone);
enable defaults to True.
- PT 9.0.0 hangs and crashes if one call turns HTTP/HTTPS on or writes
pages while both are off, so such a call changes nothing and returns
ok=false: turn one on in the server's Services > HTTP tab first.
Turning things off is always allowed.
Check it with pt_web_browser(host, "http://<server ip>").pt_server_service tool
A Server-PT's Services > TFTP / FTP / SYSLOG / EMAIL.
- service: "tftp" | "ftp" | "syslog" | "email"
- enable: True/False (None = leave alone). On EMAIL it switches SMTP
and POP3 together.
- domain, smtp, pop3: EMAIL only. The Domain Name ("lab.com"; empty =
leave alone) and each protocol On/Off; all three are read back.
- users: accounts for ftp/email:
[{"username": "alice", "password": "secret", "permissions": "RWDNL"}]
(permissions FTP only: Read Write Delete reName List).
SYSLOG also returns how many messages it received (`entries`) and the
newest 200 as PT serializes them (`messages`; fields not mapped).pt_email_client tool
A host's Desktop > Email.
- action="configure": name, address ([email protected]), username, password,
smtp_server, pop3_server (IP or name of the Server running EMAIL).
- action="send": to, subject, body (uses the configured account).
- action="receive": asks the POP3 server for mail (it shows in the
window; PT does not expose the mailbox through the API).
Server accounts are created with pt_server_service(service="email").
The server's Domain Name and SMTP/POP3 switches are set with
pt_server_service(server, "email", domain=..., smtp=..., pop3=...).pt_host_firewall tool
A host's Desktop > Firewall / IPv6 Firewall: switches the inbound
firewall on or off (True/False; None = leave alone). Individual rules
have no API in PT; edit them in the window
(pt_ui_open(host, app="firewall")).pt_terminal tool
Desktop > Terminal of a PC connected by a CONSOLE cable (RS 232) to a
router/switch: types on that device's console, as from the PC's
Terminal. This is how labs configure a device "over the console".
- device: the PC (or Laptop) that has the console cable.
- commands, timeout, auto_confirm: as in pt_cli.
- show/capture: shows the PC's Terminal app (its 9600 8N1 settings
window is accepted automatically).pt_ui_mode tool
Headless vs UI: decides whether the device-panel tools also SHOW what
they do in Packet Tracer's window.
- "headless" (default): everything through the API, no window opens.
- "ui": pt_cli, pt_host_command, pt_host_ip_config, pt_server_*... open
the device's window on the matching tab/app (CLI, Desktop > Command
Prompt, Desktop > IP Configuration, Services > DHCP...) so it can be
watched or captured.
- "status": shows the current mode.
The mode is saved and survives server restarts. Every tool also accepts
show=True/False for a single call. Use it when the user says "show it
in PT", "I want screenshots", "use the tabs" (→ "ui") or "do it in the
background" (→ "headless").pt_cli tool
Types commands into a router/switch console (CLI tab) and returns each
one's output. Same as typing in the IOS CLI: enable, configure
terminal, interface..., show ip route, ping, copy run start...
Without taking the screen: it goes through PT's API, and what is typed
shows up in the device's real CLI tab.
Parameters:
- device: exact name (pt_query_topology).
- commands: a list of commands, or a block of text with one per line.
Typed in order, waiting for the prompt between them.
- timeout: maximum seconds per command, up to 300 (ping/traceroute take a while).
When it runs out the command is aborted with Ctrl+Shift+6.
- auto_confirm: presses Enter on "[confirm]" and "Destination filename [..]?".
[yes/no] and Password: questions are NOT answered automatically: put
the answer as the next command (e.g. ["reload", "no", ""]).
- show: True/False opens (or not) the device's window on the CLI tab.
None = per pt_ui_mode.
- capture: saves a PNG of the window when done (implies show).
Each command comes back marked: ok, ERROR (% Invalid input...), UNKNOWN
COMMAND (IOS took it as a hostname: the DNS lookup is aborted), WAITING
FOR ANSWER or TIMEOUT. A freshly created router is primed automatically
(answers 'no' to the initial dialog).pt_host_command tool
Runs a command in a PC/Laptop/Server's Desktop > Command Prompt
(ping, ipconfig, ipconfig /all, ipconfig /renew, tracert, arp -a,
nslookup, netstat, telnet, ssh -l user ip, ftp...) and returns the output.
Parameters:
- device: the host's name.
- command: the line to run (e.g. "ping 192.168.1.1").
- inputs: answers to whatever the command asks afterwards, in order
(e.g. a telnet/ssh password, then commands for the remote device).
- timeout: maximum seconds per line, up to 300 (a failing ping takes ~15 s).
- show / capture / output_dir: as in pt_cli; opens Desktop > Command Prompt.pt_ui_open tool
Opens a device's window in PT on a tab/app/section, without moving the
mouse or typing (UI Automation + PT's API).
- tab: Physical | Config | CLI | Desktop | Services | Programming | Attributes
- app (Desktop): ip_configuration, command_prompt, terminal, web_browser,
pc_wireless, email, text_editor, firewall, ipv6_firewall, vpn,
traffic_generator, mib_browser, pppoe_dialer, dial_up, ip_communicator,
tftp, ssh_client, bluetooth, iot_monitor... (implies tab=Desktop)
- section: an entry in the tab's left-hand list: in Config "Settings"
or an interface ("FastEthernet0"); in Services "DHCP", "DNS", "HTTP",
"TFTP", "EMAIL", "FTP"...
Works in headless mode too: it is an explicit request to show.
Requires Windows and the [ui] extra (comtypes).pt_ui_close tool
Closes a device's window in PT, or all of them if device is empty.
pt_ui_capture tool
Saves a PNG of a device's window as it looks in PT (or of the main
window if device is empty). Works even when the window is covered.
Returns the file's PATH, not the image.
Open the tab/app you want first with pt_ui_open (or show=True on the
tool you ran). For the logical canvas without the interface there is
pt_screenshot.pt_host_ip_config tool
Desktop > IP Configuration (and Config > Global) of a PC/Laptop/Server:
static IP or DHCP, mask, gateway, DNS, IPv6 (automatic or static).
Parameters (empty = leave alone):
- mode: "static" | "dhcp". With "dhcp" a lease is requested and the
tool waits up to wait_dhcp_s seconds (0-120) for it.
- ip, mask: IPv4 and mask ("255.255.255.0" or "24").
- gateway, dns: IPv4. "0.0.0.0" to clear.
- interface: port (default: the first Ethernet, or Wireless0).
- ipv6_mode: "auto" (SLAAC) | "off".
- ipv6_address: static IPv6 with its prefix, "2001:db8:0:1::10/64".
Added to the port (it does not remove other addresses) and read back.
- ipv6_gateway, ipv6_dns.
- show / capture: opens Desktop > IP Configuration (per pt_ui_mode).
For routers/switches use pt_cli (ip address ... on the interface).pt_read_device_panel tool
Reads what a device's tabs show, in one go (read-only): model, power,
whether it is a host, DHCP, the host's default gateway, per port IP/mask/MAC/state/IPv6/firewall/
bandwidth, and on servers which services (DHCP, DNS, HTTP, TFTP, FTP,
SYSLOG, EMAIL, NTP) are on.pt_remove_module tool
Removes the module installed in a slot (Physical tab). Powers the device
off, removes it and powers it back on, like pt_add_module (routers/switches
are saved first with write memory); skipped when PT reports the module as
hot-swappable. The reply says whether it restarted and was saved.
- slot: STRING, same format as pt_add_module ("0/0", "1", "0"...).pt_apply_acl tool
Applies an ACL to a router in PT's active topology: validates (ranges, types,
IPs/wildcards, unreachable rules), checks router/interface against PT, generates IOS CLI and
sends it through configureIosDevice.
- router: device name in PT (see pt_query_topology).
- name_or_number: 1-99/1300-1999 standard, 100-199/2000-2699 extended, any word = named ACL.
- acl_type: "standard" (source only) or "extended" (source, destination, protocol, ports).
- entries: list of dicts:
action "permit"|"deny" (required); protocol "ip"|"icmp"|"tcp"|"udp"|... (default "ip");
source "any" | "host A.B.C.D" | "A.B.C.D wildcard" (required); destination (extended);
source_port_op/source_port, dest_port_op/dest_port/dest_port_end (TCP/UDP, e.g. "eq"/80);
icmp_type ("echo", "echo-reply", ...); tcp_flags (["established"]); log (bool); remark.
- binding_interface: apply the ACL to this interface; empty = only define it.
- binding_direction: "in" (default) or "out"; used only with binding_interface.
- dry_run: validate and return the CLI/JS without sending.
Example entry: {"action": "deny", "protocol": "icmp", "source": "192.168.1.0 0.0.0.255",
"destination": "192.168.0.0 0.0.0.255", "icmp_type": "echo"}.
Full example: resource pt://guide, "Tool notes".pt_apply_acl_object tool
Applies an ACL using PT's object API (AclProcess.addAcl/addStatement)
instead of CLI through configureIosDevice.
Same input as pt_apply_acl. It is faster (no CLI parsing) and less
prone to raising modal popups that break the bridge if a line goes wrong.
Limitation: binding only works on the catalog's physical ports (e.g.
GigabitEthernet0/0). For sub-interfaces (G0/0/1.20) use pt_apply_acl (CLI),
since port.setAclInID only applies to the base port and not the sub-interface.
Pipeline: validate the plan → generate statements (without the "access-list NAME " prefix)
→ run addAcl + addStatement one by one + optional binding.pt_remove_acl_object tool
Removes an ACL using the object API (AclProcess.removeAcl + Port.setAclInID="").
Alternative to pt_remove_acl (CLI). If binding_interface is given, it
first clears the port's AclInID/AclOutID and then removes the ACL.
Parameters:
- router: device name in PT
- name_or_number: identifier of the ACL to remove
- binding_interface: optional, interface where the binding was
- binding_direction: "in" or "out" (only with binding_interface)
- dry_run: if True, returns the payload without sending itpt_remove_acl tool
Removes an ACL applied on a router.
If binding_interface is given, it first removes the binding from the
interface (no ip access-group ...) and then deletes the whole ACL
(no access-list ...).
Parameters:
- router: device name in PT
- name_or_number: identifier of the ACL to remove
- binding_interface: optional, interface where it was applied
- binding_direction: "in" or "out" (only with binding_interface)
- dry_run: if True, returns the payload without sending itpt_live_deploy tool
pt_cli tool
pt_activity_open tool
Opens a .pka activity in Packet Tracer; it replaces what is open.
Parameters:
- path: full path to an existing .pka (relative = inside the working directory).
- password: only for a protected activity, the instructor's password. It goes
to PT's confirmPassword and is neither stored nor echoed. Without it a
protected activity opens but its API stays locked.pt_activity_status tool
State of the open activity: whether it is one, password confirmed, items,
correct items, points, percentage, time, instructions as text, feedback.
A password-protected activity replies locked=true. Counters are stale after
opening until the network changes (pt_activity_check(refresh=True)).pt_activity_check tool
Grades the open activity item by item: each leaf of the assessed tree with its
path, ok, value and points. Empty nodes are ignored.
Parameters:
- only_incorrect: list only what is wrong.
- refresh: after opening, PT's counters are stale until the network changes.
True sets a host's gateway to its own value, an innocuous change that makes
PT recalculate, and then reads.pt_activity_create tool
Starts a new activity: a new file with the Activity Wizard open. The canvas is
then the answer network; build it with the normal tools.
Parameters:
- force: discard what is open. Without it the tool refuses when an activity
or a never-saved network is open (PT cannot tell if a saved one changed).pt_activity_set_instructions tool
Writes the HTML of the first instruction page, with the Wizard open.
Goes through Import Page (a temporary file and PT's file dialog), the only
way PT keeps the HTML, and reads it back with getInstructionSource(0).
Reply: html_preserved, identical (apart from whitespace).pt_activity_tree tool
Children of a node of the assessment tree, to find what pt_activity_mark takes.
Parameters:
- path: steps from the top, e.g. ["R1", "Ports", "GigabitEthernet0/0"].
Empty = the top level (devices, ConnectivityTests...).pt_activity_mark tool
Marks assessment items: setCheck(true) on the whole chain from the root.
Parameters:
- items: paths, e.g. [["SW1", "Ports", "FastEthernet0/1", "Access VLAN"]].
- clear_others: uncheck everything else first.
Reply: marked, missing (with the step not found and the names there). A path
with a missing step changes nothing. Marks count after save and reopen.pt_activity_build_initial tool
Copies the answer network to the initial network (confirming "Replace Initial
Network?") and shows it. Nothing is erased here: the config students must
write is stripped with pt_cli / pt_host_ip_config.
Parameters:
- reset_config: include that next step in the reply.pt_activity_save tool
Saves the activity as a .pka, with the Wizard open or not, and verifies the
file on disk. Marks and rubric count only after reopening it.
Parameters:
- path: full path (the folder must exist) or a name for PT's save folder.
- overwrite: replace an existing file.pt_activity_exit_wizard tool
Closes the Activity Wizard, answering its two dialogs (New: No, Exit?: Yes) one
at a time. Save first: what is not saved is lost. PT clears the workspace.pt_activity_reset tool
Resets the open activity to its initial network, as a student's Reset does.
pt_activity_points tool
Sets how many points checked items are worth, with the Activity Wizard open.
PT's API can only read points, so this drives the Wizard's window: not on macOS.
- points: [{"path": ["SW1", "Ports", "FastEthernet0/1", "Access VLAN"], "points": 5}].
Every path must be checked already (pt_activity_mark).
Reply: set, not_reached, not_applied (read back from PT) and total_points.pt_activity_create_exam tool
Builds a whole exam: create, build_answer, set_instructions, mark, points, connectivity,
copy_to_initial, clear_initial, save, exit_wizard.
Parameters:
- spec: title, situation, addressing [{device, interface, ip, mask, gateway}],
requirements [{text, items, note}] (**word** = bold), language (es/en),
items (paths for pt_activity_mark), plan or plan_path (the answer network),
answer_commands and initial_commands ({device: [config lines]}, typed between
configure terminal and end), points [{path, points}] (default 1 each; not on macOS),
connectivity [{source, destination, reachable}]
(ping tests PT grades; not on macOS), initial_hosts (hosts left with no address),
output_path (.pka), overwrite.
- start_at: step to resume from, after a failure.
- force: passed to pt_activity_create.
- dry_run: validate and render the HTML, sending nothing.
Reply: one entry per step, failed_step and how to retry.pt_screenshot tool
Captures PT's logical canvas and saves it as an image.
Returns the file's PATH, not the image: a capture weighs tens of
thousands of bytes and dumping it in the reply would fill the context without
anyone being able to see it.
PNG compresses a diagram much better than JPG (measured: 33 KB versus
105 KB for the same canvas), so it is the default.
Parameters:
- filename: file name, without extension. It is sanitised.
- fmt: PNG (default) | JPG | JPEG | BMP.
- output_dir: destination folder, relative to the project root.
Example: pt_screenshot(filename="lab-ospf")pt_add_note tool
Writes a text note on PT's canvas.
Use it to document the topology on the diagram itself: label a
subnet, mark an OSPF area, name a trunk link. Returns the note's
id, which can be used to delete it later.
The coordinates are the same logical-canvas ones that pt_add_device
and pt_move_device use: routers ~y=100, switches ~y=250, hosts ~y=400.
The font size is NOT configurable: PT fixes it and uses that parameter
for the stacking order, which the tool computes by itself.
Parameters:
- x, y: position on the canvas.
- text: the note's content.
Example: pt_add_note(x=300, y=100, text="LAN 192.168.0.0/24")pt_clear_annotations tool
Removes the canvas annotations: text notes and drawings.
It does NOT touch devices or links, only the graphic elements.
PT leaves orphan note ids that it never releases — with no text and that it
refuses to delete. They are not a failure: the canvas is visually clean
anyway, and they are reported separately as `stale_ids`.
Parameters:
- kind: "all" (default) removes notes and drawings; "notes" only the notes.
Example: pt_clear_annotations()pt_canvas_info tool
Size of PT's visible logical view and where the devices are, so you know which
x/y range to use before pt_add_device / pt_move_device / pt_add_note.
Returns view [width, height] in canvas px (depends on the screen and the window:
1512x599 on a 14" MacBook, about 1900x700 on a maximised 1920x1080), zoom (0 =
100 %), the device count and their bbox [x0, y0, x1, y1]. x/y of a device is the
top-left corner of its icon (about 50x40 px, labels below): keep x within
[40, width-90] and y within [40, height-90] so everything is visible.pt_auto_layout tool
Rearrange the devices on the canvas by topology and fit them to the visible view.
Reads the live devices and links: routers form the core (2 or a chain: a row with
the end LANs pointing outward, middle LANs alternating down/up; a ring: a polygon;
a hub: a star), each LAN hangs off its router away from the core (switch, then its
hosts side by side), a WAN cloud takes the free side. Moves everything in one call
and reads each position back.
Use it after building by hand, after adding devices, or when a lab looks crowded.
pt_full_build / pt_plan_topology already plan with this layout.
Parameters:
- apply: False only returns the new positions without moving anything.pt_read_routes tool
Reads the REAL routing table of a live device (or of every router).
What `show ip route` shows, read from the device's RoutingProcess:
per route its prefix, protocol letter and name (C connected, L local,
S static, O OSPF, D EIGRP, R RIP), next hop, interface, AD and metric.
Across several routers it lists `convergence_gaps`: prefixes a router
running a dynamic protocol lacks while the others know them.
Parameters:
- device: device name; empty = every device with a routing table.
Example: did OSPF converge? pt_read_routes()pt_read_ospf tool
Reads OSPF's REAL state: router-id, areas and neighbours per process.
Each neighbour comes with its state by name (FULL, 2WAY, INIT...), its
role (DR/BDR/DROTHER, null on point-to-point), local port and address.
Flags neighbours not FULL (2WAY between DROTHERs is normal), duplicate
router-ids and routers with OSPF but no neighbours.
Parameters:
- device: router name; empty = every router.
Example: pt_read_ospf(device="R1")pt_read_arp tool
Reads the REAL ARP table (IP -> MAC -> port) of a device, router or host.
Parameters:
- device: device name; empty = every device.
Example: did PC1 resolve its gateway? pt_read_arp(device="PC1")pt_read_cdp tool
Reads the REAL CDP neighbour table: who is cabled to which port.
Per neighbour: device id, local and remote port, platform, capability.
CDP announces every 60 s: right after a deploy the table is empty.
Parameters:
- device: device name; empty = every device.
Example: pt_read_cdp(device="SW1")pt_read_stp tool
Reads Spanning Tree's REAL state per VLAN: who the root bridge is.
Per switch and VLAN: whether it is the root, the root ID (priority and
MAC), and where available its bridge ID, priority, root path cost and
root port. Across switches it flags VLANs where they disagree on the
root (not converged). PT 9 does not expose per-port STP state or role.
Parameters:
- switch: switch name; empty = every switch.
- vlans: VLAN numbers to read; empty = every VLAN in the switch.
Example: pt_read_stp(vlans=[1, 10])pt_read_acl tool
Reads the REAL ACLs of a router: each ACL with its commands, and which
ports have an ACL applied in which direction.
Flags ports that reference an ACL that does not exist. Use it to check
a pt_apply_acl.
Parameters:
- device: router name; empty = every device with ACLs.
Example: pt_read_acl(device="R1")pt_read_nat tool
Reads a router's REAL NAT state: the translation table, NAT counters
(inside source lists, statics, pools) and inside/outside interfaces.
Flags a router with NAT but without both an inside and an outside
interface. Use it to check a pt_apply_nat.
Parameters:
- device: router name; empty = every router with NAT.
Example: pt_read_nat(device="R1")pt_read_mac_table tool
Reads a switch's REAL MAC address table, per VLAN: MAC, port, dynamic or static.
Parameters:
- switch: switch name; empty = every switch.
- vlan: VLAN number; 0 = every VLAN.
Example: where did SW1 learn PC1's MAC? pt_read_mac_table(switch="SW1")pt_read_dhcp_leases tool
Reads the REAL DHCP leases a server handed out: per pool, each lease's
IP, MAC, port and lease time.
Router pools (`ip dhcp pool`) come from its DhcpServerProcess (measured
on a 2911); a Server-PT's from each port's DHCP process. A pool whose
leases this PT build cannot read says `lease_api: false`: unknown, not
zero. Use it to check that hosts got their address from the right pool.
Parameters:
- device: router or server name; empty = every DHCP server.
Example: pt_read_dhcp_leases(device="R1")pt_diff tool
Compares a plan (JSON from pt_plan_topology) against PT's LIVE topology.
Reports: plan devices missing from PT, extra devices in PT,
and per-interface IP mismatches. Useful to reconcile after a deploy.
Requires a connected bridge.pt_health_check tool
Health sweep of PT's LIVE topology.
Reports: down links (cabled but not up), cabled ports without an IP
(possibly an unfinished DHCP), and duplicate IPs. Requires a connected bridge.pt_inspect_ports tool
Real state of each port of a live device in PT.
Reads the device, not the plan: line/protocol status, MAC, IP/mask,
duplex, bandwidth, MTU, delay, CDP, DHCP client, NAT mode, applied
ACLs and, on a cabled port, the real cable type (straight, cross,
serial...) and the far end ("SW1:FastEthernet0/1"). Flags anomalies (cable connected with the port down, line up with
protocol down).
It is the DETAIL view of one device; for the sweep of the whole
topology (down links, duplicate IPs) use pt_health_check.
Parameters:
- device: device name; empty = all (verbose on large topologies).
- only_linked: if True, returns only ports with a cable connected.
Example: see why one of R1's links won't come up:
pt_inspect_ports(device="R1", only_linked=True)pt_device_power tool
Powers a device in PT on or off, with a verification read.
Useful to simulate equipment failure and see how routing reacts, or
to restart a router so it rereads its startup-config.
Works on every model, PCs included. Hosts have no IOS boot,
so when powering them on `booting` comes back null; on a router
or switch the boot is skipped so as not to wait for the full start-up.
Parameters:
- device: device name in PT.
- on: True powers on (default), False powers off.
Example: simulate R2 going down:
pt_device_power(device="R2", on=False)pt_full_build tool
Full pipeline: plans, validates, generates, explains, estimates and deploys.
deploy=True (default): with a channel to PT the topology is REALLY created (same path as
pt_live_deploy, with verification and reconcile) and project files are exported; with no
channel it falls back to manual mode (script to clipboard + step-by-step instructions).
Parameters:
- routers (1-20), pcs_per_lan, laptops_per_lan (Laptop-PT), switches_per_router, servers,
access_points (AccessPoint-PT, one per LAN), has_wan, dhcp.
- routing: static, ospf, eigrp, rip, none. ospf_process_id (1-65535, default 1),
eigrp_as (1-65535, default 100), floating_routes (static only: backup routes, AD 254).
- router_model: 1941, 2901, 2911, ISR4321. switch_model: 2960-24TT, 3560-24PS.
- template: single_lan, multi_lan, multi_lan_wan, star, hub_spoke, branch_office,
router_on_a_stick, three_router_triangle, custom.
- vlans: router_on_a_stick only; VLANs spread across the PCs (0 = default 2).
- dual_stack: add IPv6 (routers via CLI, hosts via SLAAC); ipv6_base (default "2001:db8::/32").
- wireless_laptops: laptops connect over WiFi (wireless NIC + AP).pt_live_deploy tool
Sends commands directly to Packet Tracer in real time.
Requires PT open with the MCP Control Center extension installed. With the
window open HTTP is used; if you close it, the file channel (Script
Engine) takes over. The bridge starts by itself inside the MCP server.
Parameters:
- plan_json: plan JSON (output of pt_plan_topology or pt_full_build)
- plan_path: instead of plan_json, a .json file with the plan. Use it for
large hand-written designs (dozens of sites); `extra_cli` in the plan
carries per-device IOS lines (summaries, hardening, NAT...).
- command_delay: delay between BATCHES in seconds (default 0.0).
Commands are no longer sent one by one: they go in batches that PT runs in
a single runCode, where each one carries its own try/catch. Measured
against PT 9.0, creating 10 devices + links + configuring IOS in one go
takes ~100 ms and the config is applied. Raise it only if your
installation chokes.pt_bridge_status tool
Checks which channel Packet Tracer is connected through.
There are two: HTTP (when the MCP Control Center window is open) and
file (when it is closed but PT is still open with the extension). With
either one, deployment works.pt_verify_connectivity tool
Runs a REAL ping from a device in PT and returns the result.
Unlike validations that are only printed as "check it by
hand", this runs `ping` on the device's console and parses the real
output: how many packets arrived. Use it to confirm that a freshly
deployed topology really has connectivity.
Works with hosts (PC/Server/Laptop, format "Packets: Sent=..") and with
IOS devices (router/switch, format "Success rate is N percent").
Parameters:
- from_device: name of the device the ping starts from
- to_ip: destination IP
- count: reserved; PT uses its default per type (PC 4, IOS 5). A "-n"
flag would break on IOS, so it is not forced for now.
- timeout_s: maximum wait (default 45s: on a topology deployed moments
ago, switch ports spend ~30s in STP before forwarding). A FAILED ping takes longer
than a successful one: each packet waits for its own timeout before
being declared lost (~13s measured for 4 lost packets).pt_save_project tool
Saves Packet Tracer's active topology as a .pkt file.
Closes the loop: until now the MCP built the topology but saving it
needed Ctrl+S by hand.
Parameters:
- filename: file name (.pkt is added if missing)
- directory: destination folder. Empty = PT's save folder (on Linux, where PT
reports a folder that does not exist, ~/pt/saves). An absolute
path must be an existing folder (the user's choice of where labs live);
a relative one is a folder inside the MCP's working directory.
- overwrite: replace an existing file (default False: an existing file is an error).pt_open_project tool
Opens a .pkt file in Packet Tracer.
WARNING: it replaces the topology currently open. If it has unsaved
changes, save them first with pt_save_project.
Parameters:
- path: full path to an existing .pkt file (any folder: opening the
user's own labs is the point). A relative path is looked up inside the
MCP's working directory and may not leave it.pt_list_modules tool
Lists the expansion modules available in the PT catalog.
Without filters it returns ALL modules. Useful to find the exact
names before calling pt_add_module.
Parameters:
- router_model: if given (e.g. "2911", "ISR4321"), filters to
modules compatible with that router. Includes generic modules
(no compatible_with list) and the ones that list that model.
- category: filters by category (e.g. "router_hwic", "router_nm",
"router_nim", "router_wic"). Empty = all.
Returns JSON with: name, description, category, ports_added,
compatible_with.pt_add_module tool
Installs an expansion module on a device in the active topology.
PT powers the device off, installs the module and powers it back on (with
skipBoot). A restart reloads the startup-config, so routers/switches are saved
first (write memory); the reply says whether the device restarted and was saved.
Parameters:
- device_name: exact device name in PT (e.g. "R1"). Use
pt_query_topology to list valid names.
- slot: the slot identifier as a STRING. The format depends on the
device's slot type:
* HWIC on 2911/2901 → "0/0".."0/3" · on 1941 ONLY "0/0" and "0/1"
(verified against PT 9.0.1: the 1941 has 2 slots, not 4)
(chassis-slot/hwic-subslot)
* NM on 2811/2620XM/Router-PT → "1"
* NIM on ISR4321/4331 → "0/1", "0/2" (chassis/subslot — NOT "0"/"1")
* Cloud-PT/Server-PT/PCs → "0", "1", ... depending on the available slot
An integer is accepted too and converted to a string.
- module_name: exact module name, e.g. "HWIC-2T", "NM-4A/S",
"NIM-2T", "HWIC-1GE-SFP". Use pt_list_modules to discover them.
- dry_run: if True, validates and returns the JS payload without sending it.
Example: add 2 serial ports to R1 in HWIC slot 0:
pt_add_module(device_name="R1", slot="0/0", module_name="HWIC-2T")pt_install_modules_batch tool
Installs N modules in a single runCode JS — save → power-off → addModule×N → power-on.
Useful when several serial modules (HWIC-2T, NIM-2T, etc.) have to go into
several routers at once. PREFER this tool over multiple calls to
pt_add_module: each individual power cycle can pause PT's script engine
for > 5s and kill the bridge bootstrap's polling.
Parameters:
- modules: list of dicts with {device, slot, module}. Example for RTR-4 with
4 serial ports on a 2911 (which does NOT accept NM-4A/S):
[
{"device": "RTR-4", "slot": "0/0", "module": "HWIC-2T"},
{"device": "RTR-4", "slot": "0/1", "module": "HWIC-2T"}
]
→ gives Serial0/0/0..0/0/1, Serial0/1/0..0/1/1.
- dry_run: if True, validates and returns the JS payload without sending it.
Slot rules (string):
HWIC on 2911/2901 → "0/0".."0/3" · on 1941 ONLY "0/0" and "0/1"
NIM on ISR4321/4331 → "0/1", "0/2" (chassis/subslot — NOT "0"/"1")
NM on 2811/Router-PT → "1"
Cloud-PT / hosts → "0".."7"
Returns JSON with summary and per-module status (installed or not).
The JS (js_payload) is only included with dry_run; once sent it is dropped.pt_apply_nat tool
Applies NAT or PAT to a router in PT's active topology (IOS CLI through the bridge).
- router: device name in PT (e.g. "R1"; see pt_query_topology).
- mode: "static" (1:1 fixed mapping, e.g. a server reachable from outside),
"dynamic" (pool of public IPs) or "pat" (overload: many hosts share one public IP,
the usual case).
- inside_interface / outside_interface: LAN-side and WAN-side interfaces.
- static_mappings: static only. [{"inside_local": "192.168.1.10", "inside_global": "200.1.1.5"}]
- inside_networks: dynamic/pat. "network wildcard" strings, e.g. ["192.168.1.0 0.0.0.255"]
(not CIDR); emitted as an inline access-list.
- acl_number: ACL number or name for the inside hosts (default "1").
- pool_name, pool_start, pool_end, pool_netmask ("255.255.255.0" form): the public pool
(dynamic, or pat without interface overload).
- use_interface_overload: pat only. True = use outside_interface's IP instead of a pool.
- dry_run: validate and return the payload without sending.
Typical PAT: mode="pat", inside_networks=["192.168.1.0 0.0.0.255"], use_interface_overload=True.
Mode guidance and a full example: resource pt://guide, "Tool notes".pt_remove_nat tool
Removes the NAT/PAT configuration from a router.
Removes the ip nat inside/outside marks from the interfaces and deletes
the associated translations, pool and access-list.
Parameters:
- router: device name in PT
- mode: "static" | "dynamic" | "pat"
- inside_interface: interface marked as ip nat inside
- outside_interface: interface marked as ip nat outside
- acl_number: number/name of the access-list used (default "1")
- pool_name: name of the NAT pool to remove (only dynamic/pat with a pool)
- static_mappings: mode="static" only. List of dicts with inside_local/inside_global
to generate the "no ip nat inside source static ..." commands
- dry_run: if True, returns the payload without sending itpt_list_devices tool
Lists every device available in Packet Tracer with its ports.
Use this to know which models, ports and cables you can use.pt_list_templates tool
Lists every available topology template with its description.
pt_get_device_details tool
Shows the details of a specific device model.
Accepts either the exact model name (e.g. '2911', '2960-24TT')
or a catalog alias (e.g. 'router', 'switch', 'firewall').
Parameters:
- model_name: model name or aliaspt_estimate_plan tool
Quick estimate (dry-run) without generating a full plan.
Shows how many devices, links and subnets will be created.
Parameters:
- routers: Number of routers (1-20)
- pcs_per_lan: PCs per LAN
- laptops_per_lan: Laptops per LAN (Laptop-PT)
- switches_per_router: Switches per router
- servers: Servers
- access_points: Access Points (AccessPoint-PT)
- has_wan: Include WAN
- dhcp: Configure DHCP
- routing: static, ospf, eigrp, rip, nonept_plan_topology tool
Generates a complete network topology plan for Packet Tracer.
Parameters:
- routers: Number of routers (1-20)
- pcs_per_lan: PCs per LAN
- laptops_per_lan: Laptops per LAN (Laptop-PT)
- switches_per_router: Switches per router (0-4)
- servers: Number of servers
- access_points: Number of Access Points (AccessPoint-PT), one per LAN
- has_wan: Include a WAN connection (Cloud)
- dhcp: Configure DHCP automatically
- routing: Routing protocol (static, ospf, eigrp, rip, none)
- router_model: Router model (1941, 2901, 2911, ISR4321; 2811 for CME voice)
- switch_model: Switch model (2960-24TT, 3560-24PS)
- template: Template (single_lan, multi_lan, multi_lan_wan, star, hub_spoke,
branch_office, router_on_a_stick, three_router_triangle, custom)
- floating_routes: If True with routing=static, adds backup routes with AD=254
over alternative paths (needs a topology with multiple paths)
- ospf_process_id: OSPF process ID (1-65535, default 1)
- eigrp_as: EIGRP AS number (1-65535, default 100)
- vlans: router_on_a_stick template only. Number of VLANs to spread across the PCs (0 = default 2).
- dual_stack: If True, adds IPv6 addressing (routers via CLI, hosts via SLAAC).
- ipv6_base: Base IPv6 prefix for dual-stack (default "2001:db8::/32").
- wireless_laptops: If True, laptops connect over WiFi (wireless NIC + an AP
auto-associated per LAN) instead of a cable.
Returns the full plan JSON.pt_validate_plan tool
Validates a topology plan. Returns typed errors and warnings.
Parameters:
- plan_json: plan JSON (output of pt_plan_topology)
- plan_path: instead of plan_json, a .json file with the plan (large designs)pt_fix_plan tool
Tries to fix the plan's errors automatically.
Fixes cables, upgrades routers that lack ports, reassigns ports.
Parameters:
- plan_json: JSON of the plan to fixpt_explain_plan tool
Explains the plan's decisions in natural language.
Useful to understand why certain models, IPs, etc. were chosen.
Parameters:
- plan_json: plan JSONpt_generate_script tool
Generates the PTBuilder JavaScript script.
Parameters:
- plan_json: plan JSON
- include_configs: if True, includes the CLI configs as commentspt_generate_configs tool
Generates the CLI (IOS) configurations for every router and switch.
Parameters:
- plan_json: plan JSONpt_export tool
Exports the plan to files: JS script, CLI configs and JSON.
Parameters:
- plan_json: plan JSON
- project_name: project name
- output_dir: folder inside the MCP's working directory (PT_MCP_WORKDIR);
a path that points elsewhere is reduced to a folder name there.pt_deploy tool
Deploys a plan to Packet Tracer: copies the script to the Windows
clipboard, exports the configuration files, and generates
step-by-step instructions.
Usage: after pt_full_build or pt_plan_topology, pass the plan JSON
here to prepare everything for Packet Tracer.
Parameters:
- plan_json: plan JSON (output of pt_plan_topology or pt_full_build)
- project_name: project name
- output_dir: folder inside the MCP's working directory (PT_MCP_WORKDIR);
a path that points elsewhere is reduced to a folder name there.pt_list_projects tool
Lists the saved projects.
Parameters:
- output_dir: projects folder inside the MCP's working directory (PT_MCP_WORKDIR)pt_load_project tool
Loads a saved project.
Parameters:
- project_name: project name
- output_dir: projects folder inside the MCP's working directory (PT_MCP_WORKDIR)pt_backup_config tool
Backs up a PT device's startup configuration.
Returns the real startup-config (the one the device rereads on restart),
plus its serial number, config-register, boot images and uptime.
Use it to save a known state before touching something, or to
compare two devices.
Parameters:
- device: name of the router or switch in PT.
- include_xml: if True, adds the device's full XML dump
(topology + config + modules). It is tens of thousands of characters:
useful for archiving, heavy to read.
Example: pt_backup_config(device="R1")pt_project_metadata tool
Reads (and optionally writes) the metadata of the project open in PT.
Returns the saved file, the PT version that wrote it and the
project description, together with the device and link counts.
Useful to know what you are working with before changing anything.
Parameters:
- description: if given, REPLACES the project description.
Empty = read only.
Example: pt_project_metadata()pt_workspace_options tool
Reads and adjusts PT workspace options that affect how it behaves.
Without arguments it is read-only. The flags are tri-state: 1 enables,
0 disables, -1 (default) leaves alone.
Parameters:
- auto_cabling: PT's auto-cabling picks the cable and the port for you.
Turn it off before building topologies by script if you want exact
control over which port is used.
- external_network_access: lets PT reach the machine's REAL
network. Off by default; turning it on takes traffic out of the simulator.
- show_port_labels / show_link_lights / show_device_labels: what is shown on
the canvas. It matters for a capture to be readable.
Example: turn auto-cabling off before a scripted deploy:
pt_workspace_options(auto_cabling=0)pt_apply_hsrp tool
Configures one HSRP group on a router interface through IOS CLI, each line verified
(`standby version`, `standby <g> ip|priority|preempt`). Measured on a 2911 in PT 9.
- router / interface: e.g. "R1", "GigabitEthernet0/0" (pt_query_topology).
- group: 0-4095 with version 2. Both routers use the same group and virtual_ip.
- virtual_ip: the hosts' gateway. With PT connected it must be a free host address
in the interface's live subnet, not the interface's own IP.
- priority: 0-255, default 100; the higher one becomes active.
- preempt: take over again when this router comes back (default True).
- version: 2 (measured). 1 is accepted but NOT verified.
- dry_run: validate and return the CLI/payload without sending.
Example (active router; repeat on R2 with priority=100):
pt_apply_hsrp(router="R1", interface="GigabitEthernet0/0", group=1,
virtual_ip="192.168.1.254", priority=110)
Check: pt_cli(device="R1", commands=["show standby brief"]).pt_apply_bgp tool
Configures BGP on a router through IOS CLI, each line verified (`router bgp`,
`neighbor <ip> remote-as`, `network <net> mask <mask>`). Measured on a 2911 in PT 9.
- router: router name in PT.
- asn: local AS, 1-65535 (4-byte ASNs were not measured).
- neighbors: [{"ip": "10.0.0.2", "remote_as": 65002}]; remote_as == asn is iBGP.
With PT connected, a neighbor off every connected subnet is a warning.
- networks: CIDR list, host bits zero, e.g. ["192.168.1.0/24"]. BGP only advertises
a network that is in the routing table with that exact mask. `show running-config`
prints a classful one without `mask`.
- dry_run: validate and return the CLI/payload without sending.
Example: pt_apply_bgp(router="R1", asn=65001,
neighbors=[{"ip": "10.0.0.2", "remote_as": 65002}], networks=["192.168.1.0/24"])
Check: pt_cli(device="R1", commands=["show ip bgp summary"]).pt_apply_qos tool
Configures QoS (MQC) on a router through IOS CLI, each line verified: one
`class-map match-any` per class, a `policy-map` whose class-default gets
`fair-queue`, and `service-policy output` on the interface. Measured on a 2911.
- router / interface: e.g. "R1", "GigabitEthernet0/1" (the WAN side).
- policy_name: one word, e.g. "WAN-OUT".
- classes: [{"name", "match_dscp"?, "match_protocol"?, "priority_kbps"|"bandwidth_kbps"}].
At least one match per class (both = match-any); exactly one action.
Measured: match_protocol "rtp", match_dscp "ef", priority_kbps. Other DSCP values,
other protocols and bandwidth_kbps are accepted but NOT verified (warning).
- direction: "output" only (queuing actions are outbound in IOS).
- dry_run: validate and return the CLI/payload without sending.
Example: pt_apply_qos(router="R1", interface="GigabitEthernet0/1", policy_name="WAN-OUT",
classes=[{"name": "VOICE", "match_protocol": "rtp", "match_dscp": "ef",
"priority_kbps": 512}])
Check: pt_read_qos(device="R1").pt_apply_voice tool
Cisco CME voice (IP phones) through IOS CLI, each line verified. The router MUST be
a 2811 (PT's 2911 rejects `telephony-service` even with the uck9 license).
Measured end to end on PT 9 (2811 + 3560-24PS + two 7960): CME, DHCP option 150
and real registration (`show ephone`: REGISTERED). Not measured: ephone + mac,
switchport voice vlan (the reply warns).
- source_ip: the router's IP on the phones' LAN (checked against PT).
- extensions: ["1001", "1002"] or [{"number": "1001", "mac"?: "0001.4321.ABCD"}].
- max_ephones 1-36, max_dn 1-144. auto_assign: `auto assign 1 to N`.
- voice_vlan + switch + access_ports: `switchport voice vlan` on those ports.
- dhcp_pool: `option 150 ip <source_ip>`; dhcp_network ("10.10.10.0/24") also sets
network + default-router.
- restart_phones: power-cycle every IP phone, then fast-forward (default True);
phones already on keep 0.0.0.0 otherwise.
- dry_run: validate and return the CLI/payload without sending.
Example: pt_apply_voice(router="R1", source_ip="10.10.10.1", extensions=["1001","1002"],
dhcp_pool="VOICE", dhcp_network="10.10.10.0/24")
Check: pt_cli(device="R1", commands=["show ephone"]).pt_audit_security tool
Audits the REAL security posture of the live devices in PT.
It does not read the plan: it reads the effective configuration of each router/switch
on the canvas and reports findings with a severity (high/medium/low). Detects
a missing `enable secret`, credentials stored reversibly
(type 7), `service password-encryption` off, no local
users, a missing MOTD banner and config-register at 0x2142 (which discards
the startup-config on the next reboot).
Passwords and hashes NEVER leave the device: only the label of the
algorithm they are stored with is transmitted.
Hosts (PC/Server/Laptop) are skipped: they have no IOS configuration.
Parameters:
- device: if given, audits only that device; empty = all of them.
Example: audit the whole topology:
pt_audit_security()pt_apply_netflow tool
Configures a NetFlow exporter on a PT device.
Unlike the rest of the advanced features, NetFlow does NOT go through CLI: it is
configured directly and read back to verify it was applied. If
the name already exists, it is reconfigured instead of duplicated.
The exported FLOWS are not read: no way to read them was measured on PT 9
(the exporter manager has no exporter or monitor count either).
Parameters:
- device: router where the exporter lives.
- name: exporter name (e.g. "COLLECTOR-1").
- destination_ip: the collector's IP. Without it the exporter is inert.
- udp_port: the collector's UDP port (default 2055).
- version: 9 (templates, recommended) or 5 (fixed format).
- source_port: source interface; empty = PT picks it.
- monitors: names of the monitors to associate.
- remove: if True, deletes the exporter `name` instead of creating it.
- dry_run: if True, only validates and returns the payload without touching PT.
Example: export to a collector at 192.168.0.50:
pt_apply_netflow(device="R1", name="COLLECTOR-1", destination_ip="192.168.0.50")pt_configure_dhcp_server tool
Creates or edits a DHCP pool on a Server-PT (GUI: Services > DHCP), validated against
its subnet, switches the service on and reads every pool back. No CLI (a Server-PT has none).
Router DHCP: plan with dhcp=True or CLI `ip dhcp pool`. Exclusions or showing the page on
screen: pt_server_dhcp (same JS backend, server_dhcp_js).
The server needs a static IP inside the pool's subnet (else warning DHCP_SERVER_NO_IP). PT
never leases the server's own IP but DOES lease the gateway's if the range covers it.
- device: the Server-PT.
- network / mask: pool subnet ("192.168.10.0", "255.255.255.0"). No network = read-only.
- gateway / dns: what clients receive (empty dns = left alone).
- start_ip: first IP handed out; empty = after a .1 gateway, else the first host.
- max_users: number of IPs; 0 = to the end of the subnet.
- pool_name: default "serverPool" (the factory pool the GUI shows); another name creates or
edits that pool, never duplicates.
- port: serving port (default FastEthernet0). enabled: service On/Off.
- drop_factory_pool: with a custom pool_name, delete the factory serverPool if it was never
configured (it would hand out .1, the gateway).
- remove: delete pool_name instead. dry_run: validate and return the JS only.
Example: pt_configure_dhcp_server(device="DHCP-A", network="192.168.10.0",
gateway="192.168.10.1", dns="8.8.8.8", start_ip="192.168.10.3")pt_read_qos tool
Reads a device's REAL QoS configuration: class-maps and policy-maps.
Read only (PT's API cannot create class/policy-maps): to CONFIGURE QoS
use pt_apply_qos. This tool checks that it was applied.
Returns, per class-map, its match type and CLI; per policy-map, its
classes in order, each with its name, priority (kbps), bandwidth (kbps),
fair-queue and whether it is class-default. PT does not give a class
its name, so names come from the running-config, matched by position.
Parameters:
- device: router name in PT.
Example: pt_read_qos(device="R1")pt_simulation_mode tool
Switches PT between Realtime and Simulation mode.
In Simulation mode packets do NOT move on their own: they stay queued in the
event list and have to be moved with pt_simulation_step. That is what
allows reading the path packet by packet with pt_read_packet_trace.
Parameters:
- on: True enters Simulation (default), False goes back to Realtime.
Example: pt_simulation_mode(on=True)pt_simulation_step tool
Steps the simulation forward, back, or resets it.
Requires Simulation mode (pt_simulation_mode(on=True)). Each
step moves the packets one event; after stepping, read the result
with pt_read_packet_trace.
Parameters:
- action: "forward" (default) | "back" | "reset".
- times: how many steps to take (1-100, ignored for "reset").
Example: step 5 events forward:
pt_simulation_step(action="forward", times=5)pt_read_packet_trace tool
Reads the simulation's event list: what each packet did and WHY.
Besides the path (device, ingress/egress port, source,
destination, traffic type and outcome) it returns the decision log that
PT generates per OSI layer — the same text as the "PDU Details" panel of its
GUI. That is where the real cause of a failing ping shows up, for
example: "The next-hop IP address is not in the ARP table."
Requires Simulation mode with generated traffic (pt_simulation_mode(on=True)
and then a ping, or pt_simulation_step so the events move on).
Parameters:
- limit: maximum frames to return (1-200, default 20).
- device: if given, only the frames that went through that device.
- include_decisions: if False, omits the per-layer log (shorter reply).
Example: see why a ping is dropped:
pt_read_packet_trace(limit=10)pt_apply_vlan tool
Applies VLANs / trunks / inter-VLAN routing to the active PT topology through IOS CLI:
switch side (VLANs, access ports, trunks) and optionally router side (.1q subinterfaces,
router-on-a-stick). Use pt_query_topology for the real names/ports.
- switch: switch name (e.g. "SW1"). router: only for subinterfaces.
- vlans: [{"vlan_id": 10, "name": "SALES"}] (name optional).
- access_ports: [{"switch": "SW1", "port": "FastEthernet0/1", "vlan_id": 10}].
- trunks: [{"switch", "port", "allowed_vlans"?, "native_vlan"?, "encapsulation"?}]. A 2960
(dot1q only) gets no `switchport trunk encapsulation`; a 3560 does.
- subinterfaces: [{"router": "R1", "parent_port": "GigabitEthernet0/0", "vlan_id": 10,
"ip_cidr": "192.168.10.1/24"}].
- dry_run: validate and return the CLI/payload without sending.
Router-on-a-stick example: resource pt://guide, "Tool notes".pt_apply_stp tool
Configures Spanning-Tree on a switch in the active topology.
Parameters:
- switch: switch name in PT (e.g. "SW1").
- mode: "rapid-pvst" (default) or "pvst".
- root_primary_vlans: list of VLANs where this switch is root primary (generates
`spanning-tree vlan N root primary`).
- priority: dict {vlan_id: priority}. The priority must be 0-61440 and a multiple of 4096.
- portfast_ports: access ports with `spanning-tree portfast`.
- bpduguard_ports: ports with `spanning-tree bpduguard enable`.
- dry_run: if True, only validates and returns the CLI/payload.
Example: SW1 root for VLAN 10 + portfast on Fa0/1:
pt_apply_stp(switch="SW1", root_primary_vlans=[10],
portfast_ports=["FastEthernet0/1"], dry_run=True)pt_apply_port_security tool
Configures port-security on a switch's access port.
Parameters:
- switch: switch name in PT.
- port: access port (e.g. "FastEthernet0/1").
- max_mac: maximum number of allowed MACs (default 1).
- violation: "shutdown" (default) | "restrict" | "protect".
- sticky: if True, learns sticky MACs (`mac-address sticky`).
- static_macs: static MACs in IOS aaaa.bbbb.cccc format.
- dry_run: if True, only validates and returns the CLI/payload.
Example: max 2 sticky MACs on SW1's Fa0/1:
pt_apply_port_security(switch="SW1", port="FastEthernet0/1", max_mac=2, dry_run=True)pt_apply_hardening tool
Hardens a router/switch in the active topology.
Applies via CLI: hostname, MOTD banner, enable secret, local users, SSH
(domain-name + RSA keys + `ip ssh version`), service password-encryption, and
restricts the vty lines to SSH with local login.
Parameters:
- device: device name in PT.
- hostname: new hostname (optional).
- banner_motd: MOTD banner text (without the '#' character).
- enable_secret: enable password (it is encrypted).
- users: list of {username, secret, privilege?}. Needed for SSH/local login.
- ssh: dict {domain?, modulus?, version?, enable?} to enable SSH. Requires
at least one user. modulus<768 raises a warning.
- service_password_encryption: applies `service password-encryption` (default True).
- dry_run: if True, only validates and returns the CLI/payload.
Example: full hardening of R1 with SSH:
pt_apply_hardening(device="R1", hostname="R1", enable_secret="cisco123",
users=[{"username":"admin","secret":"adminpass","privilege":15}],
ssh={"domain":"lab.local","modulus":1024}, dry_run=True)pt_apply_interface_tuning tool
Tunes the parameters of a router interface in the active topology.
Parameters (all optional except router/interface):
- router: router name in PT.
- interface: interface to tune (e.g. "Serial0/0/0", "GigabitEthernet0/0").
- clock_rate: ONLY on Serial interfaces (DCE end). E.g. 64000, 2000000.
Applying clock_rate to a non-serial interface is a validation error.
- bandwidth: bandwidth in kbps (`bandwidth N`).
- ospf_cost / ospf_priority: per-interface OSPF knobs.
- ospf_hello_interval / ospf_dead_interval: OSPF timers. They must
match the neighbour's or the adjacency won't form; the IOS
convention is dead = 4 x hello, and dead <= hello is rejected.
- ospf_md5_key + ospf_md5_key_id: OSPF message-digest authentication
(recommended). The id must match the neighbour's.
- ospf_auth_key: plain-text OSPF authentication. It works, but the
key travels readable across the network — a warning is emitted.
- delay: interface delay (affects the EIGRP metric), in tens of microseconds.
- ospf_network: "point-to-point" (only type PT accepts), for /30 links.
An ASBR's default route is re-originated (PT drops it on the change).
- dry_run: if True, only validates and returns the CLI/payload.
Example: authenticate OSPF with MD5 between R1 and its neighbour:
pt_apply_interface_tuning(router="R1", interface="GigabitEthernet0/0",
ospf_md5_key_id=1, ospf_md5_key="s3cr3t")pt_apply_etherchannel tool
Bundles switch ports into an EtherChannel (Port-channel<group>) through IOS CLI,
each line verified. Measured on a 2960-24TT in PT 9; other models are not verified.
- switch: switch name in PT.
- ports: 2-8 full port names of one speed, e.g. ["FastEthernet0/10", "FastEthernet0/11"].
A contiguous run is sent as `interface range FastEthernet0/10 - 11`.
- group: channel-group number (1-6 on a 2960).
- mode: "active"|"passive" (LACP), "desirable"|"auto" (PAgP) or "on" (static).
At least one side must be active/desirable: passive+passive or auto+auto never forms.
Configure the peer switch the same way (same group mode family, same ports count).
- trunk: True puts Port-channel<group> in `switchport mode trunk`.
- allowed_vlans: trunk only, e.g. [10, 20] (`switchport trunk allowed vlan`).
- dry_run: validate and return the CLI/payload without sending.
Check it with pt_cli(device=switch, commands=["show etherchannel summary"]).
Example: pt_apply_etherchannel(switch="SW1", ports=["FastEthernet0/10",
"FastEthernet0/11"], group=1, mode="active", trunk=True)pt_read_vlans tool
Reads a switch's REAL VLAN database in PT.
Returns each VLAN with its number, name, whether it is one of PT's
factory ones (1, 1002-1005) and its access ports; plus the trunk ports
(with native VLAN), the ports with port security, and access ports left
in a VLAN missing from the database. Use it to confirm that a
pt_apply_vlan was applied, or to discover a topology you didn't build.
Parameters:
- switch: switch name in PT.
Example: pt_read_vlans(switch="SW1")pt_query_topology tool
Query current devices in Packet Tracer.
Returns name, model, and port/IP info for each device in the active topology,
then every link with its real cable type (read from the link itself).
Requires bridge connected (use pt_bridge_status to verify).pt_export_topology tool
Export a detailed snapshot of the full topology currently in Packet Tracer.
Returns devices (name, model, x/y position, interfaces with IPs) and links
(endpoints, ports, and the REAL cable type PT reports for each link:
straight, cross, serial, fiber...). This gives a complete picture of
what is deployed so the LLM can reason about the topology.pt_delete_device tool
Delete a device from the active topology in Packet Tracer.
Uses getLogicalWorkspace().removeDevice() and verifies the device is gone.
Parameters:
- device_name: exact device name (e.g. "R1", "PC3", "Laptop-WAN")pt_rename_device tool
Rename a device in the active Packet Tracer topology.
Reads the result back: `verified` is true only when the new name resolves
to the device and the old name no longer does.
Parameters:
- old_name: current device name
- new_name: new name to assignpt_move_device tool
Move a device to new coordinates on the Packet Tracer canvas.
Reads the position back: `verified` is true when PT reports exactly (x, y).
Parameters:
- device_name: device name
- x: X coordinate (logical view, e.g. 100-800)
- y: Y coordinate (logical view, e.g. 100-600)pt_delete_link tool
Delete the link connected to a specific interface on a device in PT.
Reads both ends back: `verified` is true only when this port AND the
far-end port no longer have a link. Reports the far end and the cable.
Parameters:
- device_name: device name (e.g. "R1")
- interface_name: interface name (e.g. "GigabitEthernet0/0", "FastEthernet0/1")pt_add_device tool
Add a single device to Packet Tracer with validation.
Checks: name not empty, model exists in catalog, no duplicate name.
Parameters:
- name: device name (e.g. "R1", "SW-Core", "PC-Admin")
- model: PT model type (e.g. "2911", "2960-24TT", "PC-PT", "Server-PT")
- x: X coordinate on canvas (default 200)
- y: Y coordinate on canvas (default 200)pt_add_link tool
Create a link between two devices in Packet Tracer with full validation.
Checks: both devices exist, both ports exist, ports are free, cable type is valid.
If cable_type is omitted, it is inferred from the device categories.
Parameters:
- device1: first device name
- port1: port on device1 (e.g. "GigabitEthernet0/0", "FastEthernet0/1")
- device2: second device name
- port2: port on device2
- cable_type: cable type (straight, cross, serial, fiber, console, roll, auto, etc.)
Common aliases accepted: "crossover"→"cross", "rollover"→"roll"pt_set_port tool
Sets low-level attributes of a port on a live device in PT.
Only applies the attributes passed explicitly (parameters with
sentinel defaults). Useful for adjustments the CLI doesn't expose easily, or
that you want to apply without entering `configure terminal`.
Parameters:
- device: device name in PT (e.g. "R1")
- interface: interface name (e.g. "GigabitEthernet0/0")
- bandwidth: bandwidth in kbps (>0 to apply; 0 = don't change)
- bandwidth_auto: 1 enables BW auto-negotiation, 0 disables it, -1 doesn't change
- full_duplex: 1 full duplex, 0 half duplex, -1 doesn't change
- duplex_auto: 1 enables duplex auto-negotiation, 0 disables, -1 doesn't change
- description: descriptive text (empty = doesn't change)
- mac_address: MAC in "AABB.CCDD.EEFF" format (empty = doesn't change)
- power: 1 powers the port on, 0 off, -1 doesn't change
- zone_member: name of the port's security zone, for Zone-Based
Firewall (empty = doesn't change). Router interfaces only.
- proxy_arp: 1 enables Proxy ARP, 0 disables it, -1 doesn't change. Turning it off
is common hardening: with Proxy ARP the router answers ARPs that are not
its own and leaks information about the topology.
- ike: 1 enables IKE on the interface (IPsec VPN), 0 disables it,
-1 doesn't change.
Returns which attributes were applied (those with a method available in
the port's API). If some `setXxx` does not exist on the device's model,
it is silently ignored and only what took effect is reported.pt_send_raw tool
Send arbitrary JavaScript to Packet Tracer via bridge.
Useful for exploring the IPC API or running custom commands.
If wait_result=True, reportResult() is auto-injected into scope.
Just call reportResult(data) in your code — no need to define it.
Examples:
pt_send_raw("reportResult(getDevices('router'))", wait_result=True)
pt_send_raw("addDevice('TestR','2911',500,300)")
Parameters:
- js_code: JavaScript to execute in PT's Script Engine
- wait_result: if True, waits for a response via reportResult()
Refused: activity password material (getHashedPassword,
getChallengeKeyAsBase64, getChallengeKeyAsInts) and reading the bytes
of a .pka/.pkt.pt_send_pdu tool
The GUI's "Add Simple PDU": an ICMP echo from one device to another.
Parameters:
- source, destination: device names (pt_query_topology).
- simulation: True (default) switches PT to Simulation first, so the
PDU waits in the event list; False switches to Realtime, where PT
delivers it at once.
- steps: in Simulation, how many events to step forward right away
(0-100). With steps > 0 the reply includes the packet trace (path,
drops and PT's per-layer reason), like pt_read_packet_trace.
The first PDU between two devices can die at a router waiting on ARP,
exactly like the first ping: send it again.
Example: pt_send_pdu("PC1", "PC4", steps=10)pt_fast_forward tool
Realtime's "Fast Forward Time" button: moves PT's clock ahead at once.
Use it after cabling or changing switch links: STP needs ~30 s to put a
new port in forwarding, and fast-forwarding gets there immediately, so a
ping right after it works (measured on PT 9.0). Realtime only (in
Simulation use pt_simulation_step). The network is not reset.
pt_live_deploy and pt_verify_connectivity already do this themselves.pt_wireless_ap tool
An access point's wireless settings (AccessPoint-PT Config > Port 1),
applied and read back. With no settings it only reads.
Parameters (empty/None = leave alone):
- ssid: network name (up to 32 bytes). Clients on another SSID drop
off; giving each AP its own SSID keeps clients off the APs you rename.
- broadcast: SSID broadcast on/off.
- mac_filter: MAC filtering on/off.
- allow_listed: True = only listed MACs may associate, False = listed
MACs are denied.
- mac_list: REPLACES the filter list ("0001.63BE.8468", "00:01:63:BE:84:68").
- reset_associations: after a change, drop every client so they
re-associate against the new settings (default True; without it,
clients already associated may keep the old association).
- dry_run: only read and report what would change.
A dropped client's port still reads up/linked: confirm with a ping
(pt_host_command) or its address, not the port state. WPA/WEP are not
settable: clients need a matching profile, and PT's client profile API
is broken.pt_live_deploy tool
pt_cli tool
ui_on prompt
Packet Tracer: show device actions in PT's real windows (CLI tab, Desktop apps) for screenshots
ui_off prompt
Packet Tracer: work headless again (API only, no windows opened)
ui_status prompt
Packet Tracer: report whether device actions run headless or in PT's windows
resource_device_catalog resource
Full catalog of devices available in Packet Tracer.
resource_cable_catalog resource
Cable types available in Packet Tracer.
resource_aliases resource
Common aliases for device models.
resource_templates resource
Available topology templates with descriptions.
resource_guide resource
Full usage guide: every rule, verified PT API fact and recipe (the short
server instructions point here).resource_capabilities resource
Server capabilities and version.
DERIVED from the live tool registry: instead of keeping a hand-maintained list
that can drift (it used to say nat="unsupported" while pt_apply_nat
existed), it introspects the tools that are actually registered and reports
the support of each feature based on whether its tool exists. If introspection
fails for any reason, it falls back to the static CAPABILITIES values.What we checked
The same checks run on every server. Each line below has one of these marks:
- 8 checks: command injection, argument injection, path traversal, server-side request forgery, SQL injection, code execution, unsafe deserialization, template injectionChecked on every scan. Results in this category are published only after a person has verified them.
- Runs programs the caller choosesNo tool runs a command or program the caller supplies — 122 tool handlers traced. Not every path could be followed, so this is not a clean pass.
- Executes caller-supplied codeNo tool evaluates code the caller supplies — 122 tool handlers traced. Not every path could be followed, so this is not a clean pass.
- Reads or writes any file path HIGH1 finding in pt_validate_plan; 2 more to review
- Requests any addressNo tool sends a request to an address the caller supplies — 122 tool handlers traced. Not every path could be followed, so this is not a clean pass.
- Runs caller-supplied SQLNo tool executes a query the caller supplies — 122 tool handlers traced. Not every path could be followed, so this is not a clean pass.
- Tools that start processesNot seen in the traced code of 122 capabilities; 116 more call code the scanner could not follow, where it may happen
- Tools that touch files50 of 122 capabilities touch files; 66 more call code the scanner could not follow, where it may happen
- Tools that call the networkNot seen in the traced code of 122 capabilities; 116 more call code the scanner could not follow, where it may happen
Where the code is: 122 handlers in 22 files at commit bd3bc03590b8
src/packet_tracer_mcp/adapters/mcp/desktop_service_tools.pypt_web_browser, pt_server_dhcp, pt_server_dns, pt_server_http, pt_server_service, pt_email_client, pt_host_firewall, pt_terminalsrc/packet_tracer_mcp/adapters/mcp/device_panel_tools.pypt_ui_mode, pt_cli, pt_host_command, pt_ui_open, pt_ui_close, pt_ui_capture, pt_host_ip_config, pt_read_device_panel, pt_remove_modulesrc/packet_tracer_mcp/adapters/mcp/prompt_registry.pyui_on, ui_off, ui_statussrc/packet_tracer_mcp/adapters/mcp/resource_registry.pyresource_device_catalog, resource_cable_catalog, resource_aliases, resource_templates, resource_guide, resource_capabilitiessrc/packet_tracer_mcp/adapters/mcp/tools/acl.pypt_apply_acl, pt_apply_acl_object, pt_remove_acl_object, pt_remove_aclsrc/packet_tracer_mcp/adapters/mcp/tools/activity.pypt_live_deploy, pt_cli, pt_activity_open, pt_activity_status, pt_activity_check, pt_activity_create, pt_activity_set_instructions, pt_activity_tree, pt_activity_mark, pt_activity_build_initial, pt_activity_save, pt_activity_exit_wizard +3src/packet_tracer_mcp/adapters/mcp/tools/canvas.pypt_screenshot, pt_add_note, pt_clear_annotations, pt_canvas_info, pt_auto_layoutsrc/packet_tracer_mcp/adapters/mcp/tools/convergence.pypt_read_routes, pt_read_ospf, pt_read_arp, pt_read_cdp, pt_read_stp, pt_read_acl, pt_read_nat, pt_read_mac_table, pt_read_dhcp_leasessrc/packet_tracer_mcp/adapters/mcp/tools/inspect.pypt_diff, pt_health_check, pt_inspect_ports, pt_device_powersrc/packet_tracer_mcp/adapters/mcp/tools/live.pypt_full_build, pt_live_deploy, pt_bridge_status, pt_verify_connectivity, pt_save_project, pt_open_projectsrc/packet_tracer_mcp/adapters/mcp/tools/modules.pypt_list_modules, pt_add_module, pt_install_modules_batchsrc/packet_tracer_mcp/adapters/mcp/tools/nat.pypt_apply_nat, pt_remove_natsrc/packet_tracer_mcp/adapters/mcp/tools/planning.pypt_list_devices, pt_list_templates, pt_get_device_details, pt_estimate_plan, pt_plan_topology, pt_validate_plan, pt_fix_plan, pt_explain_plan, pt_generate_script, pt_generate_configs, pt_export, pt_deploy +2src/packet_tracer_mcp/adapters/mcp/tools/project.pypt_backup_config, pt_project_metadata, pt_workspace_optionssrc/packet_tracer_mcp/adapters/mcp/tools/routing.pypt_apply_hsrp, pt_apply_bgp, pt_apply_qos, pt_apply_voicesrc/packet_tracer_mcp/adapters/mcp/tools/security.pypt_audit_securitysrc/packet_tracer_mcp/adapters/mcp/tools/services.pypt_apply_netflow, pt_configure_dhcp_server, pt_read_qossrc/packet_tracer_mcp/adapters/mcp/tools/simulation.pypt_simulation_mode, pt_simulation_step, pt_read_packet_tracesrc/packet_tracer_mcp/adapters/mcp/tools/switching.pypt_apply_vlan, pt_apply_stp, pt_apply_port_security, pt_apply_hardening, pt_apply_interface_tuning, pt_apply_etherchannel, pt_read_vlanssrc/packet_tracer_mcp/adapters/mcp/tools/topology.pypt_query_topology, pt_export_topology, pt_delete_device, pt_rename_device, pt_move_device, pt_delete_link, pt_add_device, pt_add_link, pt_set_port, pt_send_rawsrc/packet_tracer_mcp/adapters/mcp/tools/traffic.pypt_send_pdu, pt_fast_forwardsrc/packet_tracer_mcp/adapters/mcp/tools/wireless.pypt_wireless_ap
- 5 checks: tool poisoning, instruction override, hidden content, exfiltration requests, metadata integrityChecked on every scan. Results in this category are published only after a person has verified them.
- Dependency manifests2 manifests: docs/requirements.txt, pyproject.toml
- Lockfiles checked against OSV2 files resolved and checked against the OSV database; 2 not resolved: docs/requirements.txt: 1 dependency line carries no exact version, so the installed version was not checked; pin them or add a lockfile; pyproject.toml: dependency ranges declared here were not resolved against a lockfile and were not checked
- Known vulnerabilities in production dependenciesNo production dependency with a known advisory
- Known vulnerabilities in other dependenciesNo package used only for development, tests or examples has a known advisory
- MCP SDK versionNo MCP SDK declared in a manifest
- 3 checks: credential harvesting, undeclared credential access, credentials sent over the networkChecked on every scan. Results in this category are published only after a person has verified them.
- Tools that read credentialsNot seen in the traced code of 122 capabilities; 116 more call code the scanner could not follow, where it may happen
- Environment variables5 capabilities read environment variables (often API keys)
- Authentication declaredNot checked: needs the live server's tools/list (a remote server declares how clients authenticate)
- 3 checks: undeclared network access, undeclared file access, undeclared process executionChecked on every scan. Results in this category are published only after a person has verified them.
- Tool descriptions presentEvery tool has a description the model and the user can read
- Statically known namesEvery tool's name could be read from the code
- Input schemasNot checked: needs the live server's tools/list (every tool declares an input schema)
- Destructive tools annotatedNot checked: needs the live server's tools/list (tools that write, delete or run commands carry destructivehint)
Dependencies with known vulnerabilities (0 in production)
Dependency ranges were not resolved against a lockfile, so the score is capped at 7.
No known vulnerabilities in the production dependencies that could be checked.
Past security advisories
Vulnerabilities published for this server itself, from the GitHub Advisory Database.
No security advisories have been published for this server in the GitHub Advisory Database.
How it runs
| Where it runs | On your machine, started by your MCP client from this repository or its package |
|---|---|
| Transport | not stated in the code the scanner read; most local servers talk over stdio |
| Sign-in | not checked needs the live server |
| Servers in the code | 8 (test, t) |
The project's own security
| Security policy | yes SECURITY.md |
|---|---|
| Private reporting | mentioned the policy names a private channel |
| Past advisories | none in the GitHub Advisory Database |
| Last push | 2026-11-11 |
| Signed releases | not checked yet |
Where it is published
| Listed in | 3 catalogs (github_search, glama, mcp_toplist) |
|---|---|
| License | MIT |
| Created | 2026-03-08 |
| Topics | ai-agents automation cisco-packet-tracer llm mcp networking ospf python |
Attack map
How the server is built and where its risky tools lead: servers, their tools, what the tools' code can do, and the traced route from a declared risky tool's argument to the operation it reaches. Click a node for details.