MCP Tools and Resources
Tools perform actions in the CODESYS project and return results. Reading tools have no impact on the project. Writing tools permanently change the contents or structure of the project and are marked accordingly in the table.
Tool | Description | Effect |
|---|---|---|
| Adds a library reference to the project or removes it. | Change of library references in the Library Manager |
| Assigns a program to a task so that it is executed in the runtime cycle. The tool is used after a new program has been created. The tool can also remove program calls from tasks. | Change of the program calls of tasks |
| Displays the structure of the project tree or a specific subtree. Methods, properties, and actions are optionally shown below their parent POUs. | Read only |
| Checks the project for errors and returns diagnostic messages with source paths and line numbers. In standard mode, the tool refers to precompile rules. Optionally, a full compilation can be triggered. | Read only. Optionally, the tool can trigger the compilation of the project. |
| Creates a new folder in the project tree. This tool is used to organize POUs into logical groups. | A new folder will be created in the project. |
| Creates new Structured Text objects or completely rewrites existing ones. A complete POU with nested sub-POUs can be created in a single call. Sub-POUs which are not explicitly included will be retained. | Existing objects at the same path will be overwritten. |
| Returns the path of the currently loaded project. | Read only |
| Returns the path of the active selection in CODESYS. When code is selected, line numbers and the selected text are also returned. | Read only |
| Returns a list of all libraries available in CODESYS. | Read only |
| Returns detailed documentation for specific functions of a library. Includes parameters, return type, and other relevant details. | Read only |
| Returns the full device tree and I/O configuration of all devices in the project. Includes connectors, I/O channels, mappings to variables, and device information. | Read only |
| Provides a concise overview of the contents of a library. Contains all functions, types, and their top-level signatures. | Read only |
| Returns a list of all libraries referenced in the application. | Read only |
| Returns the Structured Text source code of an object at the specified path. Nested sub-objects (e.g. methods, actions, properties, and transitions) are included in the output by default. Also supports the restriction of output by using a start and end line | Read only |
| Removes an object from the project. The tool is also used to remove individual subordinate POUs from a function block. | The object will be irrevocably deleted. |
| Renames an object and updates all references to that object. If a reference cannot be adjusted, then the renaming will not be done. | Complete renaming with a change to all references |
| Performs targeted text replacements in a Structured Text object. | The specified text will be replaced in the target object. |
| Searches the entire project code for a text pattern. Matches are returned and grouped by object path with line numbers. | Read only |
| Searches for a type or function by name over all available libraries. Returns the library name and element type. | Read only |
| Uses glob patterns to find objects in the project tree. In the case of many results with a common ancestor, the output is displayed in a group. | Read only |
Resources
Resources are read-only context data such as templates and syntax references. Unlike tools, resources do not perform actions, but provide static contents. Resources can be referenced directly in prompts, for example: "Create a test case according to the test case template".
Resource | Description |
|---|---|
CODESYS Structured Text Dialect Description | Syntax reference for the dialect of CODESYS ST with explanations and examples of the IECĀ 61131-3 standard and CODESYS-specific extensions. The reference comprises syntax rules, data types and literals, variable sections, operators, control flow, calling conventions, interfaces, inheritance, and common sources of errors. This resource can be used during code generation and code checking to avoid syntax errors caused by dialect-specific peculiarities. |
CODESYS IEC UnitTest Testcase Template | Test case template following the pattern
This resource is used when creating new unit tests so that test cases are generated according to the recommended pattern of the CODESYS Test Manager. |