Skip to main content
Glama
Industrial-AIops Energy

Industrial-AIops Energy

plc_program_section

Read-only

Retrieve the exact source code of one named PLC block or routine from an exported program file, capped at 200 lines with a truncation flag, so you can explain only that section.

Instructions

[READ][risk=low] Source text of ONE named block from an exported program.

Returns the exact source of a single block (FB/FC/OB/DB name for SCL/AWL;
Program.Routine or routine name for L5X — rungs are rendered as
'[rung N] ...'), capped at 200 lines with an explicit truncated flag, so
the agent reads exactly the section it is explaining instead of guessing.
Unknown block names fail with the list of available blocks.

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.
    block: Block/routine name (case-insensitive; quotes optional).

Returns dict: {source_file, format, block, kind, start_line, end_line,
    lines_returned, truncated, source, parse_errors}.

Example: plc_program_section(path="~/.iaiops/plc/Line3.scl", block="FB_Conveyor").

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>",
      "block": "<block>"
    },
    "name": "plc_program_section"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
blockYes

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?

Despite annotations already declaring readOnly/destructive/openWorld, the description adds substantial behavioral context: a 200-line cap with an explicit truncated flag, failure behavior for unknown block names (returns the list of available blocks), and path constraints (must exist, ≤5 MB, confined to $IAIOPS_HOME/config/READ_DIRS). These are exactly the runtime traits an agent needs and that annotations cannot express.

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 purpose is front-loaded with a clear [READ][risk=low] marker, and the subsequent lines are dense with useful detail. The Returns dict listing is slightly verbose but justified given there is no output schema, so it earns its place.

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?

For a read-only extraction tool with no output schema, the description covers scope, format-specific naming, truncation limits, failure modes, path restrictions, return shape, and a usage example. An agent has everything needed to call it correctly on the first try.

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% (bare 'Path' and 'Block' titles), so the description carries the full burden — and it does: path formats (.st/.scl/.awl/.l5x/.txt), existence and size limits, allowed directories, and block-name case-insensitivity plus optional quotes. Nothing about the two parameters is left undocumented.

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+resource: returns the exact source of ONE named block, with format-specific naming guidance (FB/FC/OB/DB for SCL/AWL, Program.Routine for L5X). This clearly distinguishes it from siblings like plc_program_outline, plc_program_snapshot, and plc_program_xref, which operate at different granularity.

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?

The rationale sentence ('so the agent reads exactly the section it is explaining instead of guessing') gives a clear usage context and contrasts against guessing, but it never names the concrete alternative siblings (outline, xref, snapshot) or states when NOT to use this tool.

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