Skip to main content
Glama
agenticcontrolio

TwinCAT Validator MCP Server

generate_skeleton

Generate canonical TwinCAT XML skeleton files for automation projects. Create structured templates for .TcPOU, .TcDUT, .TcGVL, or .TcIO file types with proper IEC 61131-3 formatting.

Instructions

Generate canonical deterministic TwinCAT XML skeleton for a file type.

Args: file_type: .TcPOU, .TcDUT, .TcGVL, or .TcIO (with or without leading dot) subtype: For .TcPOU only: function_block, function, or program

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_typeYes
subtypeNo
enforcement_modeNostrict

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'generate_skeleton' function serves as an MCP tool handler, responsible for generating a standard TwinCAT XML skeleton based on the provided file type and optional subtype. It validates inputs, invokes a helper to build the skeleton, and returns the result with metadata.
    def generate_skeleton(
        file_type: str,
        subtype: Optional[str] = None,
        enforcement_mode: str = DEFAULT_ENFORCEMENT_MODE,
    ) -> str:
        """Generate canonical deterministic TwinCAT XML skeleton for a file type.
    
        Args:
            file_type: .TcPOU, .TcDUT, .TcGVL, or .TcIO (with or without leading dot)
            subtype: For .TcPOU only: function_block, function, or program
        """
        _t0 = time.monotonic()
        ctx = None
        try:
            mode_error = _validate_enforcement_mode(enforcement_mode, start_time=_t0)
            if mode_error:
                return mode_error
            ctx = _resolve_execution_context("", enforcement_mode=enforcement_mode)
        except Exception as exc:
            return _tool_error(
                str(exc),
                start_time=_t0,
                **unresolved_policy_fields(enforcement_mode),
            )
        skeleton, error = _build_contract_skeleton(file_type, subtype)
        if error:
            return _tool_error(
                error,
                start_time=_t0,
                execution_context=ctx,
                supported_file_types=config.supported_extensions,
                supported_pou_subtypes=list(SUPPORTED_POU_SUBTYPES),
            )
    
        normalized = _normalize_file_type(file_type)
        result = {
            "success": True,
            "file_type": normalized,
            "subtype": subtype.lower() if subtype and normalized == ".TcPOU" else None,
            "contract_version": config.get_generation_contract().get("version", "unknown"),
            "skeleton": skeleton,
            "note": (
                "Fill placeholders (name/GUID/declaration/ST body), "
                "then run autofix_file with strict_contract=true."
            ),
        }
        return _with_meta(result, _t0, execution_context=ctx)
Behavior3/5

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

No annotations provided, so description carries full burden. Adds 'canonical deterministic' behavioral context, but omits critical safety profile (read-only vs. destructive), side effects, or whether output is returned vs. written to disk. Lacks disclosure of rate limits or auth requirements.

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?

Uses Args section efficiently to document constraints. Information is front-loaded with the purpose statement. Missing parameter is a content omission, not a structural verbosity issue.

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

Completeness3/5

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

Adequate for a 3-parameter tool with existing output schema (return values need not be explained). However, missing enforcement_mode parameter and lack of usage context or behavioral safety disclosure prevents a higher score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage. Description compensates well for file_type (valid extensions, dot formatting) and subtype (conditional valid values), but completely omits enforcement_mode parameter, leaving one-third of the interface undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear specific verb (Generate) and resource (TwinCAT XML skeleton), with 'deterministic' clarifying output consistency. However, it does not explicitly distinguish from sibling tools like extract_methods_to_xml or process_twincat_single.

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

Usage Guidelines2/5

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

Provides no guidance on when to use this generator versus processing/validation siblings (e.g., process_twincat_single, validate_file). No mention of prerequisites, workflow position, or when generation is preferred over extraction.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/agenticcontrolio/twincat-validator-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server