Skip to main content
Glama
KphungFROMM

motionworks-iec-mcp-server

by KphungFROMM

validate_pou

Validate generated Structured Text against the project's real symbols to catch undefined tags, types, function blocks, and invalid formal parameters before handing the code to users.

Instructions

Validate agent-written IEC code against the project's real symbols.

Call this on generated code before handing it to a user. It catches the mistakes an LLM actually makes: tags that do not exist in the project, types that are not defined, function blocks that are not in the library, and formal parameter names that the target block does not have.

Args: path: Project file or directory. code: The Structured Text body to check (no declaration blocks). declared_vars: Any VAR blocks the code relies on, so locally declared symbols are not reported as undeclared. pou_name: Optional name, used only for labelling the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
pathYes
pou_nameNo
declared_varsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral burden. It discloses that validation checks non-existent tags, undefined types, unavailable function blocks, and incorrect formal parameter names, and that declared_vars suppresses false positives for local symbols. It does not state whether the operation is read-only or requires an open project, but the 'validate' phrasing implies no mutation.

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 purpose, then usage guidance, then a compact Args list. Every sentence earns its place, with no repetition of schema defaults or boilerplate. The formatting is scannable for an agent.

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

Completeness4/5

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

The description covers the core input semantics and the scenarios it handles. Since an output schema exists, return-value explanation is not required. It omits explicit mention that a project must be open/loaded before validation, but 'against the project's real symbols' implies that dependency. Minor gap only.

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 description coverage is 0%, but the description's Args section fully compensates: it explains the meaning and constraints of every parameter, including that code must contain no declaration blocks, declared_vars prevents false undeclared errors, and pou_name is only for labeling. This is strong added value beyond the bare schema.

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?

Description opens with a specific verb+resource: 'Validate agent-written IEC code against the project's real symbols.' It clearly identifies what the tool does and distinguishes it from sibling read/list/search/render tools by focusing on validation of generated code.

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?

Explicitly tells the agent when to use it: 'Call this on generated code *before* handing it to a user.' It also explains what kinds of LLM mistakes it catches, which clarifies the intended scenario. It does not mention exclusions or alternatives, but the usage context is clear.

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