codesysultra 1.1.3 → 1.1.4
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 +66 -43
- package/package.json +1 -2
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import scriptengine as script_engine
|
|
3
3
|
import inspect
|
|
4
|
+
import os
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
def get_desktop_path():
|
|
7
|
+
import os
|
|
8
|
+
if os.name == 'nt':
|
|
9
|
+
import ctypes
|
|
10
|
+
from ctypes import wintypes
|
|
11
|
+
CSIDL_DESKTOP = 0
|
|
12
|
+
SHGFP_TYPE_CURRENT = 0
|
|
13
|
+
buf = ctypes.create_unicode_buffer(wintypes.MAX_PATH)
|
|
14
|
+
ctypes.windll.shell32.SHGetFolderPathW(0, CSIDL_DESKTOP, 0, SHGFP_TYPE_CURRENT, buf)
|
|
15
|
+
return buf.value
|
|
16
|
+
else:
|
|
17
|
+
return os.path.join(os.path.expanduser('~'), 'Desktop')
|
|
6
18
|
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
desktop_path = get_desktop_path()
|
|
20
|
+
output_file = os.path.join(desktop_path, 'codesys_api_info.txt')
|
|
21
|
+
|
|
22
|
+
api_info = []
|
|
23
|
+
|
|
24
|
+
api_info.append("=" * 60)
|
|
25
|
+
api_info.append("CODESYS Script Engine System API")
|
|
26
|
+
api_info.append("=" * 60)
|
|
27
|
+
api_info.append("")
|
|
28
|
+
|
|
29
|
+
api_info.append("=== Script Engine Modules ===")
|
|
30
|
+
api_info.append("scriptengine module:")
|
|
9
31
|
for name in dir(script_engine):
|
|
10
32
|
if not name.startswith('_'):
|
|
11
33
|
obj = getattr(script_engine, name)
|
|
12
34
|
obj_type = type(obj).__name__
|
|
13
|
-
|
|
35
|
+
api_info.append(" %s (%s)" % (name, obj_type))
|
|
14
36
|
|
|
15
37
|
if inspect.isclass(obj):
|
|
16
38
|
methods = []
|
|
@@ -18,22 +40,24 @@ for name in dir(script_engine):
|
|
|
18
40
|
if not m.startswith('_') and callable(getattr(obj, m)):
|
|
19
41
|
methods.append(m)
|
|
20
42
|
if methods:
|
|
21
|
-
|
|
43
|
+
api_info.append(" Available methods:")
|
|
22
44
|
for method in sorted(methods)[:20]:
|
|
23
|
-
|
|
45
|
+
api_info.append(" - %s" % method)
|
|
24
46
|
if len(methods) > 20:
|
|
25
|
-
|
|
47
|
+
api_info.append(" ... and %d more" % (len(methods) - 20))
|
|
26
48
|
|
|
27
|
-
|
|
49
|
+
api_info.append("")
|
|
50
|
+
api_info.append("=== Script Engine Functions ===")
|
|
28
51
|
script_functions = []
|
|
29
52
|
for name in dir(script_engine):
|
|
30
53
|
if not name.startswith('_') and callable(getattr(script_engine, name)):
|
|
31
54
|
script_functions.append(name)
|
|
32
55
|
|
|
33
56
|
for func in sorted(script_functions):
|
|
34
|
-
|
|
57
|
+
api_info.append(" - %s()" % func)
|
|
35
58
|
|
|
36
|
-
|
|
59
|
+
api_info.append("")
|
|
60
|
+
api_info.append("=== Available Enums ===")
|
|
37
61
|
enums = []
|
|
38
62
|
for name in dir(script_engine):
|
|
39
63
|
obj = getattr(script_engine, name)
|
|
@@ -41,26 +65,29 @@ for name in dir(script_engine):
|
|
|
41
65
|
enums.append((name, obj))
|
|
42
66
|
|
|
43
67
|
for enum_name, enum_obj in sorted(enums):
|
|
44
|
-
|
|
68
|
+
api_info.append("")
|
|
69
|
+
api_info.append("%s:" % enum_name)
|
|
45
70
|
members = []
|
|
46
71
|
for name in dir(enum_obj):
|
|
47
72
|
if not name.startswith('_'):
|
|
48
73
|
members.append(name)
|
|
49
74
|
for member_name in sorted(members):
|
|
50
75
|
member_value = getattr(enum_obj, member_name)
|
|
51
|
-
|
|
76
|
+
api_info.append(" %s = %s" % (member_name, member_value))
|
|
52
77
|
|
|
53
|
-
|
|
54
|
-
|
|
78
|
+
api_info.append("")
|
|
79
|
+
api_info.append("=== Project Management ===")
|
|
80
|
+
api_info.append("script_engine.projects module functions:")
|
|
55
81
|
project_functions = []
|
|
56
82
|
for name in dir(script_engine.projects):
|
|
57
83
|
if not name.startswith('_') and callable(getattr(script_engine.projects, name)):
|
|
58
84
|
project_functions.append(name)
|
|
59
85
|
|
|
60
86
|
for func in sorted(project_functions):
|
|
61
|
-
|
|
87
|
+
api_info.append(" - %s()" % func)
|
|
62
88
|
|
|
63
|
-
|
|
89
|
+
api_info.append("")
|
|
90
|
+
api_info.append("=== POU Types ===")
|
|
64
91
|
pou_types = []
|
|
65
92
|
for name in dir(script_engine):
|
|
66
93
|
obj = getattr(script_engine, name)
|
|
@@ -68,16 +95,17 @@ for name in dir(script_engine):
|
|
|
68
95
|
pou_types.append((name, obj))
|
|
69
96
|
|
|
70
97
|
for type_name, type_obj in pou_types:
|
|
71
|
-
|
|
98
|
+
api_info.append(" %s:" % type_name)
|
|
72
99
|
values = []
|
|
73
100
|
for name in dir(type_obj):
|
|
74
101
|
if not name.startswith('_') and name.isupper():
|
|
75
102
|
values.append(name)
|
|
76
103
|
for value_name in sorted(values):
|
|
77
104
|
value_value = getattr(type_obj, value_name)
|
|
78
|
-
|
|
105
|
+
api_info.append(" %s = %s" % (value_name, value_value))
|
|
79
106
|
|
|
80
|
-
|
|
107
|
+
api_info.append("")
|
|
108
|
+
api_info.append("=== Implementation Languages ===")
|
|
81
109
|
impl_langs = []
|
|
82
110
|
for name in dir(script_engine):
|
|
83
111
|
obj = getattr(script_engine, name)
|
|
@@ -85,35 +113,30 @@ for name in dir(script_engine):
|
|
|
85
113
|
impl_langs.append((name, obj))
|
|
86
114
|
|
|
87
115
|
for lang_name, lang_obj in impl_langs:
|
|
88
|
-
|
|
116
|
+
api_info.append(" %s:" % lang_name)
|
|
89
117
|
values = []
|
|
90
118
|
for name in dir(lang_obj):
|
|
91
119
|
if not name.startswith('_') and name.isupper():
|
|
92
120
|
values.append(name)
|
|
93
121
|
for value_name in sorted(values):
|
|
94
122
|
value_value = getattr(lang_obj, value_name)
|
|
95
|
-
|
|
123
|
+
api_info.append(" %s = %s" % (value_name, value_value))
|
|
96
124
|
|
|
97
|
-
|
|
125
|
+
api_info.append("")
|
|
126
|
+
api_info.append("=== Version Info ===")
|
|
98
127
|
version = getattr(script_engine, '__version__', 'Unknown')
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
print
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
print "
|
|
113
|
-
|
|
114
|
-
print " analyze(child, indent+1)"
|
|
115
|
-
print " analyze(project)"
|
|
116
|
-
|
|
117
|
-
print "\n=== Analysis Complete ==="
|
|
118
|
-
print "SCRIPT_SUCCESS: CODESYS system API retrieved successfully."
|
|
119
|
-
sys.exit(0)
|
|
128
|
+
api_info.append(" Script Engine Version: %s" % version)
|
|
129
|
+
|
|
130
|
+
api_info.append("")
|
|
131
|
+
api_info.append("=" * 60)
|
|
132
|
+
api_info.append("Analysis Complete")
|
|
133
|
+
api_info.append("=" * 60)
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
|
137
|
+
f.write('\n'.join(api_info))
|
|
138
|
+
print("SCRIPT_SUCCESS: API info written to %s" % output_file)
|
|
139
|
+
sys.exit(0)
|
|
140
|
+
except Exception as e:
|
|
141
|
+
print("SCRIPT_ERROR: Failed to write file: %s" % str(e))
|
|
142
|
+
sys.exit(1)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesysultra",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for CODESYS automation platform",
|
|
5
5
|
"main": "dist/server.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.10.2",
|
|
38
38
|
"axios": "^1.6.8",
|
|
39
|
-
"codesysultra": "^1.1.2",
|
|
40
39
|
"commander": "^11.1.0",
|
|
41
40
|
"yargs": "^17.7.2",
|
|
42
41
|
"zod": "^3.24.3"
|