Skip to main content
Glama

pt_run_js

Run JavaScript inside Packet Tracer's script engine to query network, window, or simulation state and return JSON results. Use it as an escape hatch for tasks the standard tools don't cover.

Instructions

Escape hatch: run JavaScript inside PT's script engine and return the JSON result. The code is a function body: use return. Globals: ipc (IPC root: ipc.network(), ipc.appWindow(), ipc.simulation()), PTM (this server's helpers: PTM.dev(name), PTM.snapshot(), PTM.cli(name, lines, mode)...). Example: return ipc.network().getDevice('R1').getPort('GigabitEthernet0/0').getMacAddress();

Input Schema

NameRequiredDescriptionDefault
codeYes
timeoutNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.6

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only supply openWorldHint=false, so the description carries most of the burden. It usefully discloses the execution model ("the code is a function body: use `return`"), the return format (JSON result), and the available global namespaces — real value beyond the annotations. It does not disclose side-effect profile (whether arbitrary JS can mutate lab state), sandboxing/security constraints, or what happens on timeout, which matters for an arbitrary-code-execution tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the purpose and the escape-hatch caveat, then the calling convention, then the globals and a worked example. Every sentence carries information an agent needs to author a correct call; no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, but the description states it returns a JSON result, and the execution contract (function body, return, globals) is spelled out. The globals list ends in "...", leaving the full API surface undiscoverable from the description alone, and timeout behavior is absent — minor gaps for an escape-hatch tool that has a dedicated API-discovery sibling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does so strongly for `code`: function-body semantics, `return` requirement, global namespaces with callable examples, and a concrete usage example. The second parameter, `timeout` (default 60), is never mentioned — no units, no behavior on expiry — leaving one of two parameters undocumented in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("run JavaScript inside PT's script engine and return the JSON result") and frames itself as an "escape hatch," which immediately positions it against the many structured siblings like pt_cli, pt_device, and pt_topology. An agent can identify what this does and why it differs from the purpose-built tools without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Escape hatch" clearly signals this is the fallback for operations the structured tools don't cover, and the example shows the intended granular-object idiom. However, it never explicitly says to prefer dedicated tools first or names which sibling to reach for instead, so the routing is implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.