Skip to main content
Glama
agenticcontrolio

TwinCAT Validator MCP Server

validate_for_import

Check TwinCAT XML files for import readiness by validating structure and compliance with IEC 61131-3 standards before deployment.

Instructions

Quick validation check for TwinCAT import readiness.

Args: file_path: Path to TwinCAT file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
enforcement_modeNostrict

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Implementation of the 'validate_for_import' tool, which performs a quick validation check for TwinCAT file import readiness.
    def validate_for_import(
        file_path: str, enforcement_mode: str = DEFAULT_ENFORCEMENT_MODE
    ) -> str:
        """Quick validation check for TwinCAT import readiness.
    
        Args:
            file_path: Path to TwinCAT file
        """
        _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(file_path, enforcement_mode=enforcement_mode)
            path, error = _validate_file_path(file_path, start_time=_t0, execution_context=ctx)
            if error:
                return error
    
            engine_start = time.time()
    
            file = TwinCATFile.from_path(path)
            engine_result = validation_engine.validate(file, "critical")
    
            safe_to_import = engine_result.errors == 0
    
            deduped_issues = _dedupe_validation_issues(engine_result.issues)
            critical_issues = [
                {"category": issue.category, "message": issue.message, "severity": "critical"}
                for issue in deduped_issues
                if issue.severity in ("error", "critical")
            ]
    
            result = {
                "success": True,
                "file_path": str(path),
                "safe_to_import": safe_to_import,
                "critical_issues": critical_issues,
                "error_count": engine_result.errors,
                "validation_time": round(time.time() - engine_start, 3),
            }
    
            return _with_meta(result, _t0, execution_context=ctx)
    
        except Exception as e:
            error_kwargs = {"execution_context": ctx}
            if ctx is None:
                error_kwargs.update(unresolved_policy_fields(enforcement_mode))
            return _tool_error(
                str(e),
                file_path=file_path,
                start_time=_t0,
                **error_kwargs,
            )
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It hints at performance characteristics ('Quick') and purpose ('import readiness'), but fails to disclose what validation rules are applied, what the output schema contains, error handling behavior, or whether this is read-only vs. potentially modifying state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is brief (two sentences) and front-loads the core purpose. However, the 'Args:' formatting is more typical of code documentation than tool descriptions, and the second sentence is incomplete (missing enforcement_mode documentation). It is appropriately sized but structurally suboptimal.

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

Completeness2/5

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

Given the presence of an output schema, the description correctly omits return value details. However, it is incomplete due to missing parameter documentation (enforcement_mode) and lack of sibling differentiation context. With 0% schema coverage and 2 parameters, the description fails to provide sufficient semantic coverage.

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

Parameters2/5

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

The schema has 0% description coverage, so the description must compensate. It documents only the 'file_path' parameter ('Path to TwinCAT file') but completely omits the 'enforcement_mode' parameter, leaving its purpose and valid values (default: 'strict') unexplained despite being functionally significant.

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?

The description clearly states this performs a 'validation check for TwinCAT import readiness,' specifying the verb (validate), resource (TwinCAT file), and scope (import readiness). It distinguishes from siblings like 'validate_file' or 'validate_batch' by specifying the import context, though it could further clarify the distinction from 'check_specific'.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus its numerous validation siblings (validate_file, validate_batch, check_specific, get_validation_summary). There is no mention of prerequisites, when-not-to-use conditions, or alternative tools.

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