Skip to main content
Glama
Industrial-AIops Energy

Industrial-AIops Energy

plc_program_xref

Read-only

Trace every read, write, call, and declaration site of a PLC symbol or absolute address in an exported program file, returning verbatim source lines so agents cite real code.

Instructions

[READ][risk=low] Cross-reference one symbol in an exported PLC program.

Finds every read/write/call/declare site of a symbol or absolute address
(e.g. Motor_Run, "FB_Conveyor", DB10.DBX0.1, M0.0, Tank[2].Level) in one
exported file, quoting the surrounding source line verbatim so the agent
cites real code. Access classification is heuristic (op/regex based, not
data-flow analysis): SCL ':='→write, '('→call; AWL T/=/S/R→write,
L/A/O…→read, CALL→call; L5X OTE/OTL/OTU/RES and MOV-dest→write. For L5X,
line is the rung number.

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.
    symbol: Symbol / tag / absolute address to trace (word-bounded match).

Returns dict: {source_file, format, symbol, hit_count,
    hits:[{symbol, access, block, source_file, line, source_line}] (≤200),
    hits_truncated, by_access:{read, write, call, declare, reference}}.

Example: plc_program_xref(path="~/.iaiops/plc/OB1.awl", symbol="M10.0").

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>",
      "symbol": "<symbol>"
    },
    "name": "plc_program_xref"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
symbolYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.9

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnly/destructive annotations: discloses that access classification is heuristic (op/regex based, not data-flow), spells out the per-format attribution rules (SCL, AWL, L5X), notes the 200-hit truncation cap, and states the ≤5 MB and directory-restriction constraints on path. These are exactly the caveats an agent needs to interpret results correctly.

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?

Front-loaded with the tag and one-line purpose, then progressively detailed sections for classification heuristics, args, and returns. The format-specific detail is dense but each clause carries operational meaning; nothing is redundant with the schema.

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?

No output schema exists, but the description enumerates the return dict keys (source_file, format, hit_count, hits fields, hits_truncated, by_access counts), which fully substitutes. Combined with the heuristic caveat and truncation disclosure, an agent has everything needed to call and interpret it.

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?

With schema coverage at 0%, the description fully compensates: path documents accepted extensions, size limit, and allowed root directories; symbol documents the word-bounded matching rule and supplies concrete examples across formats (Motor_Run, DB10.DBX0.1, Tank[2].Level). No ambiguity remains about what to pass.

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?

States a specific verb and resource ('Cross-reference one symbol in an exported PLC program') and immediately elaborates the exact operation: finding every read/write/call/declare site with verbatim source lines. This is clearly differentiable from sibling viewers like plc_program_outline and plc_program_section, which browse structure rather than trace symbol references.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by 'in one exported file' and the path constraints, which tell the agent an export must already exist. However, there is no explicit guidance on when to prefer this over plc_program_visibility or diagnose_dataflow, and no stated exclusions. It leaves the routing decision to inference.

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