TwinCAT Validator MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| validate_fileA | Validate a single TwinCAT file. Args: file_path: Path to TwinCAT file validation_level: "all", "critical", or "style" profile: Output profile - "full" (verbose, default) or "llm_strict" (minimal) intent_profile: Programming paradigm intent — "auto" (default), "procedural", or "oop". Controls which check families run: - "procedural": OOP checks are skipped. - "oop": Full OOP check family is enforced. - "auto": Resolved from file content (EXTENDS/IMPLEMENTS → oop, else procedural). Returns: JSON string with validation results. |
| validate_for_importC | Quick validation check for TwinCAT import readiness. Args: file_path: Path to TwinCAT file |
| check_specificC | Run specific validation checks on a TwinCAT file. Args: file_path: Path to TwinCAT file check_names: List of check IDs to run |
| get_validation_summaryB | Get high-level file quality summary with health score. Args: file_path: Path to TwinCAT file |
| suggest_fixesA | Generate prioritized fix recommendations from validation results. Args: validation_result: JSON string from validate_file() |
| autofix_fileB | Automatically fix common TwinCAT XML issues. Args: file_path: Path to TwinCAT file create_backup: Create backup before fixing fixes_to_apply: List of fix IDs, or None for all profile: "full" (default) verbose response, "llm_strict" minimal response format_profile: "default" or "twincat_canonical" formatting pass strict_contract: If True, fail closed on generation-contract violations create_implicit_files: If True, auto-create missing implicit dependency files (currently interface .TcIO files for IMPLEMENTS I_* clauses) orchestration_hints: If True, include next_action/terminal/no_change hints and content fingerprints for loop prevention in weak agents. intent_profile: Programming paradigm intent — "auto" (default), "procedural", or "oop". Controls which check families are used in post-fix validation. |
| generate_skeletonB | 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 |
| extract_methods_to_xmlB | Promote inline METHOD blocks from main ST to XML elements. Args: file_path: Path to .TcPOU file create_backup: Create .bak backup when content changes |
| validate_batchA | Validate multiple TwinCAT files matching glob patterns. Args: file_patterns: Glob patterns (e.g., ["*.TcPOU"]) directory_path: Base directory validation_level: "all", "critical", or "style" intent_profile: Programming paradigm intent — "auto" (default), "procedural", or "oop". With "auto", the matched .TcPOU files are scanned for EXTENDS/ IMPLEMENTS; if any are found the batch resolves to "oop", otherwise "procedural". ctx: FastMCP context for per-file progress notifications (injected automatically) |
| autofix_batchB | Automatically fix multiple TwinCAT files matching glob patterns. Args: file_patterns: Glob patterns (e.g., ["*.TcPOU"]) directory_path: Base directory create_backup: Create backup files before fixing profile: Response profile passed to per-file autofix (default: llm_strict) format_profile: Formatting profile for per-file autofix strict_contract: Enforce generation contract fail-closed in per-file autofix create_implicit_files: Auto-create missing interface/DUT dependencies orchestration_hints: Include loop-guard hints in per-file responses intent_profile: Programming paradigm intent — "auto" (default), "procedural", or "oop". With "auto", each file's content is inspected individually for EXTENDS/IMPLEMENTS, so OOP files receive full OOP checks even in mixed batches. ctx: FastMCP context for per-file progress notifications (injected automatically) |
| process_twincat_singleA | Run enforced deterministic single-file TwinCAT workflow. Steps:
Args: file_path: Path to the TwinCAT file to process. create_backup: Create a backup before applying fixes. validation_level: "all", "critical", or "style". enforcement_mode: Policy enforcement mode ("strict" or "compat"). include_knowledge_hints: Include recommended_check_ids from blockers. intent_profile: Programming paradigm intent — "auto" (default), "procedural", or "oop". Controls which check families run: - "procedural": OOP checks are skipped (safe for plain FUNCTION_BLOCK/PROGRAM). - "oop": Full OOP check family is enforced. - "auto": Resolved from file content (EXTENDS/IMPLEMENTS → oop, else procedural). |
| process_twincat_batchA | Run enforced deterministic batch TwinCAT workflow. Steps:
Args: file_patterns: Glob patterns (e.g., ["*.TcPOU"]) directory_path: Base directory create_backup: Create backup files before fixing validation_level: "all", "critical", or "style" enforcement_mode: Policy enforcement mode ("strict" or "compat") response_mode: "summary" (minimal, default), "compact" (no pre/post blobs), or "full" (all detail sections included). include_sections: In summary mode only — optional list of heavy sections to add. Supported: "blockers", "issues", "pre_validation", "autofix", "post_validation", "effective_oop_policy", "meta_detailed". Unknown names are ignored with a warning in the response. Has no effect in compact or full mode. include_knowledge_hints: Include recommended_check_ids from blockers (when not done). intent_profile: Programming paradigm intent — "auto" (default), "procedural", or "oop". Controls which check families run: - "procedural": OOP checks are skipped. - "oop": Full OOP check family is enforced. - "auto": Scans matched .TcPOU declarations for EXTENDS/IMPLEMENTS; resolves to "oop" if any are found, otherwise "procedural". |
| verify_determinism_batchA | Run strict batch orchestration twice and report per-file idempotence stability. Args: file_patterns: Glob patterns (e.g., ["*.TcPOU"]) directory_path: Base directory create_backup: Create backup files before fixing validation_level: "all", "critical", or "style" enforcement_mode: Policy enforcement mode ("strict" or "compat") response_mode: "summary" (minimal, default), "compact", or "full". include_sections: In summary mode only — optional heavy sections to include. Supported: "blockers", "pre_validation", "autofix", "post_validation", "effective_oop_policy", "meta_detailed". Unknown names ignored with a warning in the response. Has no effect in compact or full mode. |
| get_effective_oop_policyA | Get effective OOP validation policy for a file or directory target. Args: target_path: Optional path to a file or directory. If omitted, uses current working directory defaults. |
| lint_oop_policyB | Lint nearest .twincat-validator.json policy keys/types and return normalized policy. |
| get_context_packA | Get curated knowledge base entries and OOP policy scoped by workflow stage. Stages:
Args: stage: Workflow stage ("pre_generation" or "troubleshooting"). check_ids: Explicit check IDs (required for troubleshooting, ignored for pre_generation). target_path: Optional file/dir path for OOP policy resolution. max_entries: Maximum KB entries to return (default 10). include_examples: Include correct_examples and common_mistakes arrays (default True). Set False to save tokens. enforcement_mode: Policy enforcement mode ("strict" or "compat"). intent_profile: Programming paradigm intent — "oop", "procedural", or "auto". In pre_generation stage: - omitted: defaults to "oop" (backward compatible behavior). - "oop": Core + OOP check guidance is returned. - "procedural": Only core (non-OOP) check guidance is returned. - "auto": No file content is available at pre-generation time, so resolves to "procedural". Use "oop" or "procedural" explicitly for predictability. In troubleshooting stage: - explicit value is required (workflow guardrail). - value has no routing effect (check_ids drive selection). Returns: JSON with effective_oop_policy, curated entries[], missing_check_ids[], intent metadata, truncation info, and meta envelope. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| validate_and_fix | Canonical one-shot workflow: validate a TwinCAT file, apply all auto-fixable issues, then re-validate to report remaining blockers. Use this for the standard LLM-generated-file → server-fixes → done flow. |
| prepare_for_import | Check whether a TwinCAT file is safe to import into TwinCAT XAE. If not, list each blocker with a clear explanation. Use this before adding a generated file to a TwinCAT project. |
| check_oop_compliance | Run a full OOP compliance review on a TwinCAT .TcPOU file. Explains each OOP warning using knowledge-base excerpts and provides actionable fix suggestions. Use this for code review of Function Blocks that use EXTENDS, IMPLEMENTS, or ABSTRACT. |
| batch_normalize | Canonicalize all TwinCAT PLC files in a directory: apply tab→space, GUID casing, LineIds, and formatting fixes. Reports which files needed changes and which were already canonical. Use this as a pre-commit normalization step. |
| check_naming_only | Run only the naming_conventions check on a TwinCAT file and list all violations with the expected naming pattern. Use this for quick naming compliance reviews. |
| fix_then_verify | Apply canonical formatting to a TwinCAT file, then immediately validate to confirm the result is clean. Returns a pass/fail verdict with any remaining issues. Use this as the final step before committing a generated file. |
| generate_and_validate | Generate a canonical TwinCAT skeleton file of the requested type, save it, and immediately validate it. Use this as a starting point when creating a new Function Block, Interface, DUT, or GVL. |
| explain_check | Fetch the knowledge-base entry for a specific validation check and format it as a developer learning resource. Explains what the check detects, why it matters, shows correct and incorrect examples, and gives the fix suggestion. Use this when a developer asks 'what does this check mean?' |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| get_validation_rules | Get comprehensive list of all validation rules. |
| get_fix_capabilities | Get list of all auto-fixable issues and fix descriptions. |
| get_naming_conventions | Get TwinCAT naming convention rules. |
| get_server_info | Get server information and capabilities. |
| get_knowledge_base | Get the complete TwinCAT validation knowledge base (Phase 3). Returns: JSON with explanations, examples, common mistakes, and TwinCAT concepts |
| get_generation_contract_resource | Get deterministic generation contracts for all supported TwinCAT file types. |
| get_oop_policy_defaults_resource | Get default OOP validation policy from packaged config. |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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