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 |
|---|---|---|
| Displays the structure of the project tree or a specific subtree. Methods, properties, and actions are optionally shown below their parent POUs. | Read only |
| 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 |
| 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 |
| 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 |
| 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. | Read only |
| 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. |
| Performs targeted text replacements in a Structured Text object. | The specified text will be replaced in the target object. |
| 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. |
| Removes an object from the project. The tool is also used to remove individual sub-POUs from a function block. | The object will be irrevocably deleted. |
| 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. | A new program call will be added to the task. |
| 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. |
| Returns a list of all libraries available in CODESYS. | Read only |
| Returns a list of all libraries referenced in the application. | Read only |
| Adds a library reference to the project. | A new reference will be added to the Library Manager. |
| Provides a concise overview of the contents of a library. Contains all functions, types, and their top-level signatures. | Read only |
| Returns detailed documentation for specific functions of a library. Includes parameters, return type, and other relevant details. | Read only |
| Searches for a type or function by name over all available libraries. Returns the library name and element type. | 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 |