Skip to main content
Glama
iftahs
by iftahs

pi_run_pjsr

pi_run_pjsr

Run arbitrary PixInsight JavaScript (PJSR) directly in the active instance to execute custom processing or return JSON results, enabling advanced automation beyond predefined operations.

Instructions

Escape hatch: run arbitrary PJSR (PixInsight JavaScript) inside the warm PixInsight instance. Assign result = ... to return JSON. Helpers: PIMCP.win.view(id), PIMCP.stf, PIMCP.preview.render(view,{out_path}), PIMCP.K.{GRAY,RGB,REAL,INTEGER,NOSWAP} (macros are not visible to eval). Gated by config allowRawScripts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYes
timeout_msNo
script_argsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

Annotations only provide readOnlyHint=false, destructiveHint=false, openWorldHint=false, leaving room for the description to add behavioral context. It does add gate to config, helpers, and the 'macros are not visible to eval' detail, but it does not disclose the potentially destructive/generalized consequences of arbitrary code execution or side effects beyond 'run'. This is adequate but not thorough for a 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?

The description is front-loaded with the 'Escape hatch' context and each sentence contributes distinct information: what it runs, how to return data, about helper functions, and the configuration gate. It has no wasted or redundant phrases and stays under four sentences.

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

Completeness3/5

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

For a low-level escape hatch with no output schema, it explains the return convention and gives helper hints, covering the tool's core contract. But it omits examples, doesn't explain `script_args` or `timeout_ms`, and doesn't describe error behavior or caveats—gaps that matter when executing arbitrary code.

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

Parameters2/5

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

Schema description coverage is 0% with three parameters, so the description must compensate. It clarifies that `script` holds the PJSR code and that `result = ...` returns JSON, but it completely ignores `timeout_ms` and `script_args`. The description provides only partial semantic meaning for the parameters.

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?

The description explicitly identifies the verb ('run'), the resource ('arbitrary PJSR'), and the context ('inside the warm PixInsight instance'). The label 'Escape hatch' sets it apart from the specialized sibling tools like process_params and pixel_math. Agents can distinguish this tool from all other operations without inspecting its 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 that this is the fallback when standard operations don't cover a case, and 'Gated by config allowRawScripts' adds an explicit availability condition. However, it doesn't name specific alternative tools or explicitly state 'when not to use' scenarios, only clear context with no exclusions.

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