Skip to main content
Glama

Plecs Run Script

plecs_run_script

Executes a named simulation script in a PLECS model to trigger model-defined automation or simulation workflows via RPC.

Instructions

Run a model Simulation Script by name.

Verified on PLECS 5.0.6: the second argument is an optStruct, not a bare string — plecs.runScript(model, {"ScriptName": name}). A successful run returns null; the script's printed output goes to the PLECS console/Octave log and is not captured by RPC. Use params only for a raw override.

script_name must exactly match a Script { Name "..." } block in the .plecs file. The RPC model tree does not expose script names; use plecs_overview(model).scripts or read the file. A wrong name lists the available scripts in the error.

Input Schema

NameRequiredDescriptionDefault
paramsNo
model_nameYes
script_nameYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.1

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it discloses that success returns `null`, that the script's printed output goes to the PLECS console/Octave log and is NOT captured by RPC (a critical expectation-setting detail), and that a wrong script name produces an error listing available scripts. These are exactly the behaviors an agent cannot infer from the schema.

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

Conciseness4/5

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

Front-loaded with the one-line purpose, then the call-form correction, then the return/error semantics. Every sentence adds information; markup and backticks make it slightly denser than needed but nothing is redundant.

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?

Covers the high-risk unknowns well: correct argument shape, non-captured output, discovery path for valid script names, and error behavior. The remaining gap is `model_name` semantics — whether a connection/loaded model is a prerequisite — which matters for a tool in a suite with plecs_connect and plecs_load siblings.

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 largely does: `script_name` is constrained to exactly match a `Script { Name "..." }` block, and `params` is disambiguated as a raw override rather than the normal path. `model_name` is left unexplained (no indication of whether it must be loaded or connected first).

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 and resource: 'Run a model Simulation Script by name.' That is clearly distinct from sibling tools like plecs_simulate or plecs_rpc, though the description never explicitly contrasts itself with them, so an agent must infer that this executes an embedded `Script` block rather than a full simulation.

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?

Gives real operational guidance: the exact call form (`plecs.runScript(model, {"ScriptName": name})`), the note that `params` is only for a raw override, and the fact that script names are not in the RPC model tree and must come from `plecs_overview(model).scripts` or the `.plecs` file. It does not state when to prefer this over `plecs_simulate`, but the surrounding context is clear enough to route correctly.

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