Skip to main content
Glama
Industrial-AIops Energy

Industrial-AIops Energy

plc_program_visibility

Read-only

Analyze an exported legacy PLC program for maintainability and operational risk: comment coverage, dead blocks, complexity hotspots, risky constructs, and a cited additive risk score.

Instructions

[READ][risk=low] Maintainability / operational-risk profile of a legacy PLC program.

The "what am I inheriting?" view over one EXPORTED program (SCL/ST, AWL/STL,
Rockwell L5X): folds the structural outline into documentation coverage, the
least-commented blocks, blocks nothing references (possible dead code), the
complexity hotspots, risky constructs (unconditional JMPs, retentive RTO
timers, loops), and a TRANSPARENT additive risk score whose every point cites
its reason. Structural only — it anchors an engineer's review of a line
somebody else left behind, not a semantic understanding. Reads exactly the
named file (≤5 MB); never a live PLC upload. Every finding cites source_file +
line (rung number for L5X ladder).

Args:
    path: Exported program file (.st/.scl/.awl/.l5x/.txt; must exist, ≤5 MB),
        under $IAIOPS_HOME, the config dir or an IAIOPS_AGENT_READ_DIRS dir.

Returns dict: {source_file, fmt, stats:{blocks, call_edges, line_count,
    comment_count, comment_ratio, variables, branches, timers_counters},
    documentation:{comment_ratio, band ('well_commented'|'sparse'|
    'undocumented'), uncommented_block_count, uncommented_blocks},
    entry_points:[{name, kind}], unreferenced_blocks:[{name, kind,
    source_file, line}], complexity_hotspots:[{block, kind, score, branches,
    calls, timers_counters, source_file, line}], risky_constructs:{
    unconditional_jumps, unconditional_jump_count, loops, loop_count,
    retentive_timers, retentive_timer_count}, risk:{score (0..100), band
    ('low'|'medium'|'high'), reasons[]}, parse_errors, note}.

Example: plc_program_visibility(path="~/.iaiops/plc/Line3_Conveyor.scl").

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": {
      "path": "<path>"
    },
    "name": "plc_program_visibility"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.9

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the readOnlyHint/destructiveHint annotations, it discloses the ≤5 MB file cap, the path-confinement rule ($IAIOPS_HOME, config dir, IAIOPS_AGENT_READ_DIRS), that it reads exactly one exported file and never a live PLC, and that every finding carries source_file + line (rung number for L5X). It also explains that the risk score is transparent and additive with a cited reason per point.

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?

The headline and the structural facets are front-loaded before the Args/Returns blocks, so an agent gets the gist immediately. The Returns block is long, though its verbosity is partly justified by the absence of an output schema; a few parenthetical asides could be trimmed.

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

Completeness5/5

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

With one parameter and no output schema, the description supplies the full result shape (stats, documentation, entry_points, unreferenced_blocks, complexity_hotspots, risky_constructs, risk with bands, parse_errors, note), so an agent knows exactly what it will get. Combined with the size and path constraints, nothing material is missing.

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

Parameters5/5

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

Schema coverage is 0% and the param is just a bare string, so the description must carry the load — and it does: accepted extensions (.st/.scl/.awl/.l5x/.txt), must exist, size limit, and the allowed directory roots. A concrete example call is included as well.

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?

First line names a specific deliverable — a maintainability/operational-risk profile of an exported PLC program — and enumerates the facets it folds together (documentation coverage, dead code, complexity hotspots, risky constructs, additive risk score). The 'what am I inheriting?' framing plus 'Structural only ... not a semantic understanding' cleanly separates it from the outline/xref/section siblings without needing to reference them by name.

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?

It gives a clear use context ('anchors an engineer's review of a line somebody else left behind') and an implicit exclusion ('never a live PLC upload'), which tells the agent when this is the right tool. It stops short of naming alternatives such as plc_program_outline or plc_program_xref as the explicit fallback for pure structural or cross-reference needs.

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

Deploy Server

Other Tools