Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Mats2208/MCP-Packet-Tracer/llms.txt

Use this file to discover all available pages before exploring further.

pt_validate_plan runs a structured validation pass over a TopologyPlan JSON and returns a typed result containing errors, warnings, and a validity flag. The validation engine checks multiple categories independently — device models, cable types and port conflicts, IP addressing, DHCP, routing, ACL, and NAT — and collects all issues before returning, so you see every problem in a single call rather than fixing one at a time. Each error carries a machine-readable error_code from a fixed set of 34 codes, a human-readable message, the affected device, and a suggestion for how to fix it.

Parameter

plan_json
string
required
The TopologyPlan serialized as a JSON string — the direct output of pt_plan_topology. The tool first checks that the JSON is parseable and contains a non-empty devices array before running any domain validation.

Returns

valid
boolean
true when there are zero errors (warnings are allowed). false if any error was found.
error_count
integer
Total number of errors in the plan.
warning_count
integer
Total number of warnings in the plan.
errors
array
List of error objects. Each object has: error_code (string), device (string), message (string), suggestion (string).
warnings
array
List of warning objects with the same shape as errors. Warnings do not make the plan invalid but indicate configuration issues worth reviewing.
summary
string
A one-line human-readable summary: "✅ Plan válido. Sin errores." or "❌ Plan con N error(es).".

34 Error Codes

The validator reports errors using a fixed taxonomy of ErrorCode values. The table below groups them by category. In addition, two special pre-validation codes — INVALID_JSON (unparseable input) and EMPTY_PLAN (missing or empty devices array) — are returned before any domain checks run.

Device Errors

Error CodeMeaning
UNKNOWN_DEVICE_MODELA device references a model name that does not exist in the 74-model catalog
DUPLICATE_DEVICE_NAMETwo or more devices share the same name
INSUFFICIENT_PORTSA router or switch does not have enough physical ports for all its declared links
Error CodeMeaning
DEVICE_NOT_FOUNDA link references a device name that does not exist in the plan
INVALID_PORTA link references a port name that does not exist on the device’s model
PORT_ALREADY_USEDThe same port appears in more than one link on the same device
INVALID_CABLE_TYPEThe cable type specified for a link is not one of the 15 supported PT cable types

IP Errors

Error CodeMeaning
INVALID_IP_ADDRESSAn IP address on a device interface is malformed or not a valid IPv4 address
SUBNET_OVERLAPTwo or more LAN or link subnets have overlapping address ranges
IP_CONFLICTTwo devices share the same IP address

DHCP Errors

Error CodeMeaning
DHCP_ROUTER_NOT_FOUNDA DHCP pool references a router name that does not exist in the plan
DHCP_GATEWAY_MISMATCHA DHCP pool’s gateway IP does not match any interface on its router (reported as a warning, not an error)

Routing Errors

Error CodeMeaning
UNSUPPORTED_ROUTING_PROTOCOLThe routing protocol value is not one of static, ospf, eigrp, rip, none
TEMPLATE_CONSTRAINT_VIOLATIONThe number of routers or switches violates a constraint of the selected template

ACL Errors

Error CodeMeaning
ACL_ROUTER_NOT_FOUNDAn ACL references a router not present in the active topology
ACL_INTERFACE_NOT_FOUNDAn ACL binding references an interface not found on the router
ACL_INVALID_NUMBERThe ACL number is outside IOS valid ranges (standard: 1–99, extended: 100–199)
ACL_TYPE_MISMATCHThe ACL number range contradicts the declared ACL type
ACL_DUPLICATE_SEQUENCETwo or more ACL entries share the same sequence number
ACL_INVALID_WILDCARDA wildcard mask in an ACL entry is not a valid inverse mask
ACL_INVALID_PROTOCOL_FOR_PORTSPort operators (eq, range) are used with a protocol that does not support ports
ACL_UNREACHABLE_RULEA permit any or deny any rule makes subsequent rules unreachable
ACL_EMPTYAn ACL was declared with no entries

NAT Errors

Error CodeMeaning
NAT_ROUTER_NOT_FOUNDNAT config references a router not in the topology
NAT_INTERFACE_NOT_FOUNDInside or outside interface not found on the router
NAT_INVALID_IPA static NAT mapping contains a malformed IP address
NAT_INVALID_NETMASKA NAT pool or static mapping contains an invalid subnet mask
NAT_POOL_RANGE_INVALIDThe NAT pool start IP is higher than the pool end IP
NAT_MISSING_INSIDE_NETWORKSDynamic or PAT mode requires inside_networks but none were provided
NAT_MISSING_STATIC_MAPPINGSStatic NAT mode requires static_mappings but none were provided
NAT_MISSING_POOLDynamic NAT mode requires a named pool but none was defined
NAT_SAME_INTERFACEInside and outside interfaces are the same interface

General Errors

Error CodeMeaning
INVALID_INTERFACE_ASSIGNMENTAn interface assignment is structurally invalid
VALIDATION_ERRORA catch-all for validation failures that do not fit a more specific category

Example Validation Error Response

{
  "valid": false,
  "error_count": 2,
  "warning_count": 1,
  "errors": [
    {
      "error_code": "INVALID_PORT",
      "device": "R1",
      "message": "Port 'GigabitEthernet0/3' does not exist on model '1941' (has 2 GigabitEthernet ports)",
      "suggestion": "Use GigabitEthernet0/0 or GigabitEthernet0/1, or upgrade the router model to 2911"
    },
    {
      "error_code": "PORT_ALREADY_USED",
      "device": "R2",
      "message": "Port 'GigabitEthernet0/0' is used in more than one link",
      "suggestion": "Assign the second link to GigabitEthernet0/1"
    }
  ],
  "warnings": [
    {
      "error_code": "DHCP_GATEWAY_MISMATCH",
      "device": "R1",
      "message": "DHCP pool gateway 192.168.1.1 does not match any R1 interface",
      "suggestion": "Check that the DHCP pool gateway matches the router's LAN interface IP"
    }
  ],
  "summary": "❌ Plan con 2 error(es)."
}
After receiving validation errors, use pt_fix_plan to automatically correct the most common issues — wrong cable types, insufficient ports leading to model upgrades, and invalid port reassignments. After auto-fixing, run pt_validate_plan again to confirm the plan is clean before generating scripts.

Build docs developers (and LLMs) love