Skip to main content

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

browse_project_tree

Displays the structure of the project tree or a specific subtree. Methods, properties, and actions are optionally shown below their parent POUs.

Read only

get_active_app_as_path

Returns the path of the currently loaded project.

Read only

get_active_path_and_selection

Returns the path of the active selection in CODESYS. When code is selected, line numbers and the selected text are also returned.

Read only

search_path_by_glob

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

search_in_files_by_regex

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

get_structured_text_content

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

create_or_replace_structured_text_object

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.

replace_text_in_structured_text

Performs targeted text replacements in a Structured Text object.

The specified text will be replaced in the target object.

create_folder

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.

remove_object

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.

add_program_call_to_task

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.

check_for_errors

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.

get_available_libraries_list

Returns a list of all libraries available in CODESYS.

Read only

get_libraries_referenced_in_application

Returns a list of all libraries referenced in the application.

Read only

add_library

Adds a library reference to the project.

A new reference will be added to the Library Manager.

get_library_documentation

Provides a concise overview of the contents of a library. Contains all functions, types, and their top-level signatures.

Read only

get_detailed_library_documentation

Returns detailed documentation for specific functions of a library. Includes parameters, return type, and other relevant details.

Read only

search_liebraries_for_type

Searches for a type or function by name over all available libraries. Returns the library name and element type.

Read only

get_device_and_io_configuration

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