pt_send_raw
Execute arbitrary JavaScript in Packet Tracer through the bridge, optionally waiting for results by calling reportResult() in your code. Use it to explore the IPC API or run custom commands.
Instructions
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()
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"js_code": "<js_code>"
},
"name": "pt_send_raw"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| js_code | Yes | ||
| wait_result | No |