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_send_raw is the escape hatch for advanced Packet Tracer automation. It queues arbitrary JavaScript code on the HTTP bridge at http://127.0.0.1:54321/queue, where PTBuilder’s webview picks it up and executes it in Packet Tracer’s Script Engine via $se('runCode', ...). This tool bypasses all validation, planning, and abstraction layers — giving you direct access to PT’s full Script Engine API for custom operations, debugging, or scenarios not covered by the standard tools.
Parameters
JavaScript code to execute in Packet Tracer’s Script Engine. The code runs in the same context as PTBuilder’s
userfunctions.js, so all built-in functions (addDevice, addLink, configureIosDevice, ipc, $se, etc.) and the runtime-patched helpers (lwAddDevice, lwAddLink, configurePcIp, addModule) are available. The script engine strips newlines, so use semicolons as statement separators rather than relying on line breaks.When
true, the tool sends the code and then blocks on GET /result for up to 10 seconds, waiting for the JavaScript to call reportResult(value) to post a return value back through the bridge. When false, the code is queued fire-and-forget and the tool returns "Comando enviado a PT." immediately.Return value
wait_result=false:"Comando enviado a PT."on success, or"Error al enviar comando al bridge."if the HTTP POST fails.wait_result=true: The string value passed toreportResult(...)by the JavaScript code, or"Sin respuesta (timeout). Asegúrate de que el código llame a reportResult(...)."if no result arrives within 10 seconds.
Use cases
Explore the PT Script Engine API — query device properties, list ports, or inspect the network model without a structured tool:pt_live_deploy:
Script Engine context
The Script Engine runs ECMAScript (not Node.js) with PTBuilder’suserfunctions.js in scope. Key built-ins available:
| Object / function | Description |
|---|---|
ipc | PTBuilder IPC object — root of the PT API |
ipc.network() | Access the PT network model (devices, ports, links) |
ipc.appWindow() | Access the PT application window and workspace |
$se(method, arg) | Call Script Engine methods directly |
addDevice(name, model, x, y) | Add a device (low-level, physical view) |
lwAddDevice(name, type, model, x, y) | Add a device to logical canvas (patched helper) |
lwAddLink(d1, p1, d2, p2, cableType) | Add a cable to logical canvas — cableType is a numeric PT IPC enum (e.g. 8100 straight, 8107 auto) |
configureIosDevice(name, commands) | Push IOS CLI to a router/switch (patched helper) |
configurePcIp(name, dhcp, ip, mask, gw) | Configure PC IP (patched helper) |
reportResult(value) | Post a result back to the bridge (used with wait_result=true) |
allModuleTypes | Map of module name strings to PT module type objects |
Bridge requirement
pt_send_raw requires the HTTP bridge to be active and PTBuilder to be polling. Call pt_bridge_status to verify the connection before using this tool.
See also
pt_set_port is an additional live tool that sets low-level port attributes (bandwidth, duplex, description, MAC address, power state) on an existing device in PT via the bridge. Use it when you need to adjust interface properties that the IOS CLI does not expose or that you want to apply without entering configure terminal.