Skip to main content
Glama

pt_run_js

Execute custom JavaScript in Packet Tracer's Script Engine to access the IPC API and return the last expression as a JSON-serializable value.

Instructions

Escape hatch: evaluate raw JavaScript in Packet Tracer's Script Engine. The full IPC API is available as ipc (e.g. ipc.network().getDeviceCount()) and the helper object PTMCP. The value of the last expression is returned; it must be JSON-serializable (convert IPC objects to strings/numbers).

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": {
      "code": "<code>"
    },
    "name": "pt_run_js"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
timeoutNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries full burden for a mutation-capable tool. It does add real context the annotations would otherwise cover: the available `ipc` and `PTMCP` objects, return-value semantics (last expression), and the JSON-serializability constraint. However, it doesn't disclose safety profile (does arbitrary code mutate project state?), permission needs, or error/timeout behavior.

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?

Three tight sentences: purpose front-loaded, then API surface, then return contract. Zero filler; every sentence carries usable information.

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?

For an arbitrary-code tool with no annotations and no output schema, the description covers what's needed to call it: available globals, return contract, and serialization requirement. Missing pieces are timeout semantics and mutation/safety expectations, but the core contract is complete.

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

Parameters3/5

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

Schema coverage is 0%, so the description must compensate. It explains what `code` should contain (JS using `ipc`/`PTMCP`) and what it returns, which is helpful. But the `timeout` parameter (default 60, presumably seconds) is never mentioned, and the format/units of `code` remain lifted from the schema title only.

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

Purpose4/5

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

States a specific verb+resource: 'evaluate raw JavaScript in Packet Tracer's Script Engine', and frames it as an 'escape hatch', which distinguishes it from the many purpose-built pt_* siblings. It doesn't explicitly name a sibling, but the escape-hatch framing makes the distinction inferable.

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

Usage Guidelines3/5

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

Implies usage ('escape hatch' suggests raw JS should be used when dedicated tools don't cover the need), but never states when to prefer it over pt_cli, pt_configure_host, or other siblings, and gives no exclusions or caveats about side effects.

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