codesysultra 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/get_all_tools.py +113 -118
- package/package.json +2 -2
|
@@ -1,124 +1,119 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import scriptengine as script_engine
|
|
3
|
-
import traceback
|
|
4
3
|
import inspect
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if not name.startswith('_'):
|
|
13
|
-
obj = getattr(script_engine, name)
|
|
14
|
-
obj_type = type(obj).__name__
|
|
15
|
-
print " %s (%s)" % (name, obj_type)
|
|
16
|
-
|
|
17
|
-
if inspect.isclass(obj):
|
|
18
|
-
methods = []
|
|
19
|
-
for m in dir(obj):
|
|
20
|
-
if not m.startswith('_') and callable(getattr(obj, m)):
|
|
21
|
-
methods.append(m)
|
|
22
|
-
if methods:
|
|
23
|
-
print " Available methods:"
|
|
24
|
-
for method in sorted(methods)[:20]:
|
|
25
|
-
print " - %s" % method
|
|
26
|
-
if len(methods) > 20:
|
|
27
|
-
print " ... and %d more" % (len(methods) - 20)
|
|
28
|
-
|
|
29
|
-
print "\n=== Script Engine Functions ==="
|
|
30
|
-
script_functions = []
|
|
31
|
-
for name in dir(script_engine):
|
|
32
|
-
if not name.startswith('_') and callable(getattr(script_engine, name)):
|
|
33
|
-
script_functions.append(name)
|
|
34
|
-
|
|
35
|
-
for func in sorted(script_functions):
|
|
36
|
-
print " - %s()" % func
|
|
37
|
-
|
|
38
|
-
print "\n=== Available Enums ==="
|
|
39
|
-
enums = []
|
|
40
|
-
for name in dir(script_engine):
|
|
41
|
-
obj = getattr(script_engine, name)
|
|
42
|
-
if inspect.isclass(obj) and issubclass(obj, int):
|
|
43
|
-
enums.append((name, obj))
|
|
44
|
-
|
|
45
|
-
for enum_name, enum_obj in sorted(enums):
|
|
46
|
-
print "\n%s:" % enum_name
|
|
47
|
-
members = []
|
|
48
|
-
for name in dir(enum_obj):
|
|
49
|
-
if not name.startswith('_'):
|
|
50
|
-
members.append(name)
|
|
51
|
-
for member_name in sorted(members):
|
|
52
|
-
member_value = getattr(enum_obj, member_name)
|
|
53
|
-
print " %s = %s" % (member_name, member_value)
|
|
54
|
-
|
|
55
|
-
print "\n=== Project Management ==="
|
|
56
|
-
print "script_engine.projects module functions:"
|
|
57
|
-
project_functions = []
|
|
58
|
-
for name in dir(script_engine.projects):
|
|
59
|
-
if not name.startswith('_') and callable(getattr(script_engine.projects, name)):
|
|
60
|
-
project_functions.append(name)
|
|
61
|
-
|
|
62
|
-
for func in sorted(project_functions):
|
|
63
|
-
print " - %s()" % func
|
|
64
|
-
|
|
65
|
-
print "\n=== POU Types ==="
|
|
66
|
-
pou_types = []
|
|
67
|
-
for name in dir(script_engine):
|
|
68
|
-
obj = getattr(script_engine, name)
|
|
69
|
-
if 'PouType' in name:
|
|
70
|
-
pou_types.append((name, obj))
|
|
71
|
-
|
|
72
|
-
for type_name, type_obj in pou_types:
|
|
73
|
-
print " %s:" % type_name
|
|
74
|
-
values = []
|
|
75
|
-
for name in dir(type_obj):
|
|
76
|
-
if not name.startswith('_') and name.isupper():
|
|
77
|
-
values.append(name)
|
|
78
|
-
for value_name in sorted(values):
|
|
79
|
-
value_value = getattr(type_obj, value_name)
|
|
80
|
-
print " %s = %s" % (value_name, value_value)
|
|
81
|
-
|
|
82
|
-
print "\n=== Implementation Languages ==="
|
|
83
|
-
impl_langs = []
|
|
84
|
-
for name in dir(script_engine):
|
|
5
|
+
print "\n=== CODESYS Script Engine System API ===\n"
|
|
6
|
+
|
|
7
|
+
print "=== Script Engine Modules ==="
|
|
8
|
+
print "scriptengine module:"
|
|
9
|
+
for name in dir(script_engine):
|
|
10
|
+
if not name.startswith('_'):
|
|
85
11
|
obj = getattr(script_engine, name)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
print "
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
12
|
+
obj_type = type(obj).__name__
|
|
13
|
+
print " %s (%s)" % (name, obj_type)
|
|
14
|
+
|
|
15
|
+
if inspect.isclass(obj):
|
|
16
|
+
methods = []
|
|
17
|
+
for m in dir(obj):
|
|
18
|
+
if not m.startswith('_') and callable(getattr(obj, m)):
|
|
19
|
+
methods.append(m)
|
|
20
|
+
if methods:
|
|
21
|
+
print " Available methods:"
|
|
22
|
+
for method in sorted(methods)[:20]:
|
|
23
|
+
print " - %s" % method
|
|
24
|
+
if len(methods) > 20:
|
|
25
|
+
print " ... and %d more" % (len(methods) - 20)
|
|
26
|
+
|
|
27
|
+
print "\n=== Script Engine Functions ==="
|
|
28
|
+
script_functions = []
|
|
29
|
+
for name in dir(script_engine):
|
|
30
|
+
if not name.startswith('_') and callable(getattr(script_engine, name)):
|
|
31
|
+
script_functions.append(name)
|
|
32
|
+
|
|
33
|
+
for func in sorted(script_functions):
|
|
34
|
+
print " - %s()" % func
|
|
35
|
+
|
|
36
|
+
print "\n=== Available Enums ==="
|
|
37
|
+
enums = []
|
|
38
|
+
for name in dir(script_engine):
|
|
39
|
+
obj = getattr(script_engine, name)
|
|
40
|
+
if inspect.isclass(obj) and issubclass(obj, int):
|
|
41
|
+
enums.append((name, obj))
|
|
42
|
+
|
|
43
|
+
for enum_name, enum_obj in sorted(enums):
|
|
44
|
+
print "\n%s:" % enum_name
|
|
45
|
+
members = []
|
|
46
|
+
for name in dir(enum_obj):
|
|
47
|
+
if not name.startswith('_'):
|
|
48
|
+
members.append(name)
|
|
49
|
+
for member_name in sorted(members):
|
|
50
|
+
member_value = getattr(enum_obj, member_name)
|
|
51
|
+
print " %s = %s" % (member_name, member_value)
|
|
52
|
+
|
|
53
|
+
print "\n=== Project Management ==="
|
|
54
|
+
print "script_engine.projects module functions:"
|
|
55
|
+
project_functions = []
|
|
56
|
+
for name in dir(script_engine.projects):
|
|
57
|
+
if not name.startswith('_') and callable(getattr(script_engine.projects, name)):
|
|
58
|
+
project_functions.append(name)
|
|
59
|
+
|
|
60
|
+
for func in sorted(project_functions):
|
|
61
|
+
print " - %s()" % func
|
|
62
|
+
|
|
63
|
+
print "\n=== POU Types ==="
|
|
64
|
+
pou_types = []
|
|
65
|
+
for name in dir(script_engine):
|
|
66
|
+
obj = getattr(script_engine, name)
|
|
67
|
+
if 'PouType' in name:
|
|
68
|
+
pou_types.append((name, obj))
|
|
69
|
+
|
|
70
|
+
for type_name, type_obj in pou_types:
|
|
71
|
+
print " %s:" % type_name
|
|
72
|
+
values = []
|
|
73
|
+
for name in dir(type_obj):
|
|
74
|
+
if not name.startswith('_') and name.isupper():
|
|
75
|
+
values.append(name)
|
|
76
|
+
for value_name in sorted(values):
|
|
77
|
+
value_value = getattr(type_obj, value_name)
|
|
78
|
+
print " %s = %s" % (value_name, value_value)
|
|
79
|
+
|
|
80
|
+
print "\n=== Implementation Languages ==="
|
|
81
|
+
impl_langs = []
|
|
82
|
+
for name in dir(script_engine):
|
|
83
|
+
obj = getattr(script_engine, name)
|
|
84
|
+
if 'ImplementationLanguage' in name:
|
|
85
|
+
impl_langs.append((name, obj))
|
|
86
|
+
|
|
87
|
+
for lang_name, lang_obj in impl_langs:
|
|
88
|
+
print " %s:" % lang_name
|
|
89
|
+
values = []
|
|
90
|
+
for name in dir(lang_obj):
|
|
91
|
+
if not name.startswith('_') and name.isupper():
|
|
92
|
+
values.append(name)
|
|
93
|
+
for value_name in sorted(values):
|
|
94
|
+
value_value = getattr(lang_obj, value_name)
|
|
95
|
+
print " %s = %s" % (value_name, value_value)
|
|
96
|
+
|
|
97
|
+
print "\n=== Version Info ==="
|
|
98
|
+
version = getattr(script_engine, '__version__', 'Unknown')
|
|
99
|
+
print " Script Engine Version: %s" % version
|
|
100
|
+
|
|
101
|
+
print "\n=== API Usage Examples ==="
|
|
102
|
+
print "Example 1: Open a project"
|
|
103
|
+
print " project = script_engine.projects.open('C:/Projects/MyProject.project')"
|
|
104
|
+
print ""
|
|
105
|
+
print "Example 2: Create a POU"
|
|
106
|
+
print " parent = project.get_children()[0]"
|
|
107
|
+
print " pou = parent.create_pou(name='MyPOU', type=script_engine.PouType.Program)"
|
|
108
|
+
print ""
|
|
109
|
+
print "Example 3: Get project structure"
|
|
110
|
+
print " def analyze(obj, indent=0):"
|
|
111
|
+
print " print ' ' * indent + obj.get_name()"
|
|
112
|
+
print " if hasattr(obj, 'get_children'):"
|
|
113
|
+
print " for child in obj.get_children():"
|
|
114
|
+
print " analyze(child, indent+1)"
|
|
115
|
+
print " analyze(project)"
|
|
122
116
|
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
print "\n=== Analysis Complete ==="
|
|
118
|
+
print "SCRIPT_SUCCESS: CODESYS system API retrieved successfully."
|
|
119
|
+
sys.exit(0)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesysultra",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for CODESYS automation platform",
|
|
5
5
|
"main": "dist/server.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.10.2",
|
|
38
38
|
"axios": "^1.6.8",
|
|
39
|
-
"codesysultra": "^1.1.
|
|
39
|
+
"codesysultra": "^1.1.2",
|
|
40
40
|
"commander": "^11.1.0",
|
|
41
41
|
"yargs": "^17.7.2",
|
|
42
42
|
"zod": "^3.24.3"
|