Skip to main content
Glama
KphungFROMM

motionworks-iec-mcp-server

by KphungFROMM

render_pou_source

Generate POU source code in MotionWorks IEC's export format with properties header, declarations, and body.

Instructions

Emit a POU in the shape MotionWorks' Extended IEC 61131-2 export uses.

Produces the (*@PROPERTIES_EX@ ... *) header, the PROGRAM/FUNCTION_BLOCK line, the declaration blocks and the (*@KEY@: WORKSHEET ... *) body region — the same structure the IDE writes when exporting a POU as text.

Whether the IDE imports this shape is not verified: that format is undocumented in the installed help, whose documented import path is PLCopen XML (File → Import → "Import PLCopen xml file"). So either create a POU in the IDE and paste the code, or wrap the result in PLCopen XML for the documented route.

Args: name: POU name. pou_type: "program", "function_block" or "function". language: Body language — "ST", "LD" or "FBD". declaration: The VAR blocks, without the closing END_* keyword. code: The Structured Text body. description: Free text stored in the POU's DESCRIPTION region.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNo
nameYes
languageNoST
pou_typeNoprogram
declarationNo
descriptionNo

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 full burden. It discloses the output shape and the uncertainty about IDE import support, which is key behavioral context. It does not mention side effects (e.g., project modifications) or prerequisites (e.g., open project), but for a rendering tool these are likely minor. The limitation is clearly stated, showing transparency.

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 description is moderately long but each sentence adds value: purpose, structure details, caveat with alternatives, and parameter list. It is front-loaded with the primary purpose and flows logically. Slight improvement could be made with bullet points for parameters, but it remains concise relative to the complexity.

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?

Given the tool has 6 parameters and an output schema, the description covers the output format, import caveat, and all parameter semantics. It provides enough for an agent to call it correctly, including how to handle the uncertain import path. The output schema itself presumably documents return values, so no omission is significant.

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%, so the description must compensate. It lists all six parameters with precise meanings: name, pou_type (with enumerated values), language (with enumerated values), declaration (with clarification about missing END_*), code (body language), and description. This adds substantial meaning beyond the raw 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?

The description states a specific verb ('Emit') and resource ('a POU') with a clear format ('MotionWorks' Extended IEC 61131-2 export'). It also details the output structure (header, declaration blocks, body region), which distinguishes it from render_type_source (for types) and other tools. The purpose is unambiguous.

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 provides context on when the output is appropriate: it matches the IDE's text export, and it explicitly warns that the IDE may not import this format, offering alternatives (paste or wrap in PLCopen XML). However, it does not explicitly state when to use this tool over siblings like render_type_source or list_languages, leaving some inference to the agent.

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