pt_cli
Sends Cisco IOS CLI commands to Packet Tracer router or switch consoles through the API and returns each command's output for configuration, troubleshooting, and verification.
Instructions
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).
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": {
"device": "<device>",
"commands": "<commands>"
},
"name": "pt_cli"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| show | No | ||
| device | Yes | ||
| capture | No | ||
| timeout | No | ||
| commands | Yes | ||
| output_dir | No | screenshots | |
| auto_confirm | No |