Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PLECS_HOSTNoAlias for PLECS_RPC_HOST. PLECS RPC is localhost-only.127.0.0.1
PLECS_PORTNoAlias for PLECS_RPC_PORT. Must match the PLECS preference.1080
PLECS_APP_PATHNoAlias for PLECS_EXECUTABLE. PLECS binary/bundle used by auto-start.
PLECS_RPC_HOSTNoPLECS RPC host (alias: PLECS_HOST). PLECS RPC is localhost-only.127.0.0.1
PLECS_RPC_PORTNoPLECS RPC port (alias: PLECS_PORT). Must match the PLECS preference.1080
PLECS_EXECUTABLENoPLECS binary/bundle used by auto-start (alias: PLECS_APP_PATH). Auto-detected if unset.
PLECS_MCP_CONFIGNoExplicit path to config.yml.
PLECS_RPC_TIMEOUTNoRead timeout for non-simulation RPC calls.30
PLECS_MCP_LOG_LEVELNoRPC timing/error logging level on stderr.INFO
PLECS_MCP_OUTPUT_DIRNoDestination for auto-saved results.~/.plecs-mcp/out
PLECS_MCP_SIM_TIMEOUTNoSolverOpts.Timeout injected into simulate/analyze.600
PLECS_MCP_ALLOW_REMOTENoSet to 1 to allow binding a non-loopback HTTP host. There is no auth.
PLECS_MCP_MAX_CSV_ROWSNoAbove this many rows, scope CSV is saved and summarised.50000
PLECS_MCP_ALLOWED_ROOTSNoWrite roots, colon-separated. Defaults to ~, /tmp, and the system temp directory.
PLECS_MCP_MAX_INLINE_POINTSNoAbove this many points, simulation results are saved and summarised.20000

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": true
}
resources
{
  "subscribe": false,
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
plecs_connectA

Handshake/health check; starts PLECS automatically when the RPC port is closed.

If the endpoint is unreachable and auto_start is true (default, or PLECS_MCP_AUTO_START=always), the newest PLECS installation for this host is launched and the port is polled for up to startup_timeout seconds. Set auto_start=false (or PLECS_MCP_AUTO_START=never) for a pure health check. Returns {"ok": true, "started": ..., ...} or {"ok": false, "launch": {...}, "hints": [...]}.

plecs_list_methodsA

List RPC methods supported by the running PLECS build (system.listMethods).

plecs_method_helpB

Return PLECS's own help text for an RPC method (system.methodHelp).

plecs_statisticsA

PLECS usage statistics: licence hints plus every open model and its state.

plecs_loadB

Open a model file. model_path must be absolute. Returns {"result": 0} on success.

plecs_saveA

Save a model. With save_as the open model is RENAMED to the new file (use the new name afterwards).

save_as is checked against the write policy: install dirs are refused and an existing target requires overwrite=true.

plecs_closeA

Close a model WITHOUT saving. Refuses when this session changed it via plecs_set.

PLECS exposes no "dirty" flag, so the guard only knows about edits made through this MCP session; pass force=true to discard them.

plecs_get_model_treeA

Return the model tree (needs an absolute path; PLECS returns base64 JSON).

summary=True drops connections and returns counts plus analysis/subsystem/component names. decode=False returns {"result": "<base64>"} unchanged.

plecs_getA

Read a component/model parameter (model params too, e.g. "TimeSpan").

Values come back as strings; without parameter a dict of all parameters is returned. For a C-Script component this includes Declarations, StartFcn, OutputFcn, UpdateFcn, DerivativeFcn and TerminateFcn, which is the first step after a compilation error.

plecs_setC

Set a parameter. value is a PLECS expression string (numbers are passed through).

plecs_state_spaceA

Extract A/B/C/D/I for one switch combination.

switches may be a list in StateSpaceOrder.Switches order, or a mapping keyed by component name ("FET") or full path ("model/FET"). Missing keys default to 0. Two RPC calls are made for you: set SwitchVector then get Topology.

plecs_simulateA

Run a simulation (blocking).

options is the PLECS optStruct (ModelVars / SolverOpts / OutputFormat); pass a LIST of optStructs to let PLECS parallelize parameter sweeps. Only models with top-level Outports return data ({"Time": [...], "Values": [...]}; over JSON-RPC, Values is signals x time). save_to writes a MatFile result to disk. summary=true replaces the raw arrays with per-signal min/max/mean/p2p/rms. Results above max_points (default 20000) are written to the MCP output dir and returned as a summary. SolverOpts.Timeout is injected (default 600 s) so PLECS aborts on its own even if the client gives up.

plecs_analyzeA

Run an analysis (blocking).

analysis_name is the analysis NAME property (e.g. "Loop Gain (AC Sweep)"), not the tree node label ("AC Sweep"). AC/Impulse/Multitone return {F, Gr, Gi}; Steady-State returns {Time, Values}. summary=true replaces raw arrays with magnitude/phase ranges plus gain crossover and phase margin. SolverOpts.Timeout is injected (verified: AnalysisOpts.Timeout is rejected).

plecs_scopeC

Send a command to a scope (HoldTrace / RemoveTrace / ClearTraces / SaveTraces / LoadTraces).

plecs_webserverA

Undocumented PLECS webserver channel (verified on PLECS 5.0.6).

Commands: getScopeInfo, getTraceNames, getScopeSignals, getScopeCsv, getCursorData, getScopeBitmap, getCircuitBitmap. Pass the command's own arguments in arguments. getScope* take a scope path; getCircuitBitmap takes the model name; getCursorData also accepts [scope, {"Index": 0}] (a bare integer is rejected).

getScopeCsv is base64 CSV; PLECS ignores its own range/size options, so time_range=[t0,t1] and decimate=N are applied here. CSVs above max_rows (default 50000) are written to the MCP output dir and only metadata is returned. Base64 images (getScopeBitmap, getCircuitBitmap, getScopeSignals) are written to save_to (or auto-saved under PLECS_MCP_OUTPUT_DIR) and replaced by saved metadata; image bytes are never returned inline.

plecs_codegenB

Generate code with PLECS Coder (requires a PLECS Coder licence).

Verified on 5.0.6: plecs.codegen runs and streams Coder diagnostics back as an RPC error ("Code generation error: ..."), which is surfaced verbatim. A model with blocks that are ignored during code generation (e.g. Small Signal Response) fails instead of producing partial artifacts.

plecs_export_fmuA

Export a subsystem as an FMU (uses the subsystem's saved FMU Export settings).

Verified on 5.0.6: only an atomic subsystem can be exported; a normal subsystem returns "Cannot export FMU for non-atomic subsystem". The signature is a single subsystem path.

plecs_run_scriptA

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.

plecs_compareB

Compare two model files with PLECS's diff engine.

Returns the raw MergedItem(...) lines plus parsed entries (depth/left/right/change/type) for direct use.

plecs_batchA

Run several RPC calls in one tool call (still serialized by the client lock).

Each item is {"method": "plecs.get", "params": ["mdl/L1", "L"], "timeout": 30}. Per-call failures are reported inline as {"ok": false, "error": ...} instead of aborting the batch, which makes parameter sweeps and multi-model inspection cheap.

plecs_extract_execution_log_dataA

Runtime execution-log counters (Jacobian/Newton/solver call counts) for the last run.

plecs_set_cosim_server_enabledC

Enable/disable the PLECS FMU Co-Simulation endpoint (global PLECS state).

plecs_signB

Append the PLECS demo signature to a model file (modifies the file).

plecs_protectA

Make a subsystem non-viewable/non-modifiable. IRREVERSIBLE once saved; requires confirm=true.

Verified on 5.0.6: the call takes a single subsystem path, returns 0, and is idempotent; it changes the open model only, so the protection becomes permanent when you save it.

plecs_crashA

Crash the running PLECS process (debug helper). Requires confirm=true.

plecs_rpcC

Raw escape hatch: call any PLECS RPC method verbatim.

Dict results are returned as-is; scalars and arrays are wrapped as {"result": ...}.

plecs_overviewA

One-call model briefing: files, state, solver settings, analyses, scopes, outports.

Cheaper than stitching statistics + get + getModelTree together yourself.

plecs_layout_checkA

Check schematic geometry of a model that is open in PLECS.

Uses the bounding box per component from plecs.webserver getCircuitBitmap plus Position/Points from the .plecs text, and reports only what is certain: LAYOUT-001 (error) two component boxes intersect, LAYOUT-002 (warning) a wire polyline has a diagonal segment, LAYOUT-003 (info) a wire is drawn across a component that is not one of its endpoints, LAYOUT-004 (info) a polar two-terminal part has terminal 1 on the wrong side for reading order (horizontal: left, vertical: top) and carries the exact direction / flipped to apply. Orientation is opt-in (include_orientation=True): it is a house style, and roughly two thirds of the bundled demos do not follow it. A crossing is cosmetic - PLECS connects only through explicit connections - but it makes the schematic hard to read.

Top-level schematic only; margin absorbs the ~2 unit rounding between schematic coordinates and rendered pixels.

plecs_validateA

Structural sanity check before simulating.

Checks solver/time settings, outports, analyses, and (by default) the native .plecs connection graph: component references, subsystem ports, C-Script terminal ranges, top-level Output indices, and C-Script code indices. Warning-level findings do not change ok.

plecs_captureC

Render a scope or analysis plot as a PNG (inline image, or a file with save_to).

analysis_name maps to <model>/Analyses/<Name property>; run the analysis first.

plecs_plotB

Run a simulation/analysis and return a PNG.

renderer: auto (default) prefers the PLECS-rendered bitmap; plecs forces it (error if unavailable); matplotlib always renders locally (needed for overlays). kind="waveform" runs a short simulation (default TimeSpan 1e-3 s); kind="bode" requires analysis_name (the analysis Name property).

plecs_submitA

Start a long blocking call in the background and return a task id.

Allowed methods: simulate, analyze, codegen, exportfmu, runScript. For runScript pass [model, {"ScriptName": name}]. PLECS has no cancel API; use SolverOpts.Timeout to bound the run.

plecs_taskC

Status/elapsed time for a background task.

plecs_task_resultA

Fetch a finished task's result (large payloads arrive as summary + saved path).

plecs_tasksB

List background tasks, newest first.

plecs_checkC

Run simulations/analyses and evaluate pass/fail assertions.

Check examples::

{"type": "signal", "index": 0, "metric": "rms", "op": ">", "value": 10}
{"type": "time", "metric": "stop", "op": ">=", "value": 1e-3}
{"type": "analysis", "metric": "phase_margin_deg", "op": ">", "value": 45}
plecs_library_searchB

Search the installed PLECS component library (types, names, default parameters).

backend: auto (default) parses Components.plecs as text and falls back to the RPC model tree if the file is missing, unreadable, corrupt, or yields no components; text / rpc force one path. The response reports backend and, when a fallback happened, fallback_reason.

plecs_scanA

Regex-search a .plecs file on disk without opening it in PLECS.

plecs_model_cloneA

Copy a model file, optionally rename/rewrite lines, then load it to verify.

replacements is a list of {"pattern": <regex>, "value": <replacement>}. This is the file-level alternative to schematic editing (PLECS RPC cannot edit a model).

plecs_artifactsC

List generated files (code generation / FMU output) with sizes.

plecs_fmu_infoA

Read FMI metadata from an .fmu/.zip or an unpacked folder.

plecs_analyze_dataB

Post-process a saved JSON result: metrics, and optional FFT/THD at a fundamental.

Accepts a single result object or the list written for a parameter sweep; list entries are summarised (and THD-processed when fundamental is given).

plecs_diagnoseA

Explain a PLECS error string and suggest next steps.

plecs_instancesB

Known PLECS endpoints for this server process (the active one is flagged).

plecs_model_editA

Edit a .plecs file structurally (PLECS RPC cannot modify a schematic).

Operations (applied in order)::

{"op": "add_component", "type": "Resistor", "name": "R2",
 "position": [400, 200], "direction": "right", "flipped": "off",
 "parameters": {"R": "10"}}
{"op": "remove_component", "name": "R2"}
{"op": "set_parameter", "component": "R2", "variable": "R", "value": "22"}
{"op": "set_orientation", "component": "R2", "direction": "up", "flipped": "on"}
{"op": "set_position", "component": "R2", "position": [400, 240]}
{"op": "connect", "source": "V_dc", "source_terminal": 1,
 "target": "R2", "target_terminal": 1, "points": [[110, 200], [400, 200]]}
{"op": "add_outport", "name": "Vout", "position": [600, 200]}

direction is right/left/up/down and flipped is on/off: set them when the component is added (or use set_orientation later) so the terminal sides match the intended signal flow. Rotating a placed component invalidates explicit Points; drop them or re-run connect so PLECS re-routes.

In-place editing requires confirm=true, obeys the same write policy as other tools (allowed roots, no install dirs), and creates a .bak-<ms> backup; pass output to write elsewhere. validate loads the result in PLECS and rolls back the in-place edit if loading fails.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
docs-quickstartPLECS-MCP quickstart
docs-rpcPLECS RPC reference
docs-analysisSimulation and analysis options
docs-errorsTroubleshooting PLECS errors
docs-gotchasCommon argument traps
docs-limitsData policy and limits

TDQS

B3.2/5.0

Scored across 45 tools

Disambiguation3/5

Most tools target a distinct action (load, save, simulate, codegen, export_fmu, etc.), but several clusters overlap: plecs_simulate/plecs_plot/plecs_capture/plecs_check/plecs_submit all run or wrap simulations, plecs_overview/plecs_statistics/plecs_get_model_tree all summarize model state, and plecs_rpc/plecs_batch/plecs_webserver are three different escape hatches. The detailed descriptions do clarify boundaries in most cases, but an agent must read carefully to pick correctly.

Naming Consistency4/5

All 45 tools share the plecs_ prefix and snake_case, which is highly predictable. However, the verb_noun convention is not uniform: many tools are noun-only (plecs_artifacts, plecs_instances, plecs_statistics, plecs_overview, plecs_scope, plecs_task, plecs_tasks, plecs_fmu_info), so the pattern is mostly but not entirely consistent.

Tool Count2/5

45 tools is far above the 15-tool sweet spot and well past the 25-tool threshold for 'heavy'. While PLECS is a genuinely complex domain (schematic editing, simulation, codegen, FMU export, RPC introspection), the surface includes several near-duplicates (submit vs simulate, capture vs plot, task/tasks/task_result) that inflate the count.

Completeness4/5

The surface is unusually thorough: model lifecycle (load/save/close/clone/edit), simulation and analysis, plotting/capture, codegen, FMU export, validation, batch execution, background tasks, and raw RPC/webserver escape hatches. Minor gaps remain, such as no explicit 'create new model from scratch' operation and artifact listing without artifact cleanup, but agents have workarounds.

Maintenance

ActivityMaintained
ResponsivenessOutdated data