plc_program_visibility
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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |