0
0
Fork 0
Codesys-MCP-SP21-plus/src/scripts
Karstein Phobic Nyvold Kvistad 763a30761d fix(compile): deep-walk message structures with _coerce_for_json before json.dumps
Empirical failure: TypeError 281474976710655L is not JSON serializable from get_message_objects().
Root cause: previous per-attribute coercion only flattened known fields (severity/text/line); nested dicts/lists carrying CLR longs slipped through.
Fix: add a recursive _coerce_for_json helper that walks dicts/lists/tuples and downcasts long->int (or str if >Int64), keeps bool, then call it before every json.dumps in both compile_project.py and get_compile_messages.py.
Docs: https://content.helpme-codesys.com/en/ScriptingEngine/ScriptSystem.html (get_message_objects), https://content.helpme-codesys.com/en/ScriptingEngine/ScriptObject.html

Note: previous commit 418f678 added the per-field coercers; this commit
strengthens that with a recursive walker per the bug doc's proposal --
defensive against any future API change that nests longs deeper.

Manual smoke test only -- requires CODESYS-in-the-loop with a project
that produces compile messages whose severity bitmask is 0xFFFFFFFFFFFF.

### Manual smoke test
1. Open a project with at least one warning or error.
2. Call mcp__codesys__compile_project on it.
3. Expect SCRIPT_SUCCESS and a populated COMPILE_MESSAGES_START block;
   no TypeError 'is not JSON serializable' anywhere in the output.
4. Repeat with mcp__codesys__get_compile_messages.
2026-04-28 20:50:15 +02:00
..
add_library.py fix(add_library): refuse to save unresolvable placeholders 2026-04-26 19:44:00 +02:00
bump_project_version.py fix(read_running_version_online): document the real root cause + fix 2026-04-26 20:13:25 +02:00
check_status.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
compile_project.py fix(compile): deep-walk message structures with _coerce_for_json before json.dumps 2026-04-28 20:50:15 +02:00
connect_to_device.py fix: 4 broken-tool fixes (compile json long, connect_to_device LoginMode, 2026-04-26 16:53:25 +02:00
create_dut.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
create_folder.py fix(create_folder): WORKING -- create_folder returns void, walk children to detect success 2026-04-26 17:23:26 +02:00
create_gvl.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
create_method.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
create_pou.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
create_project.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
create_property.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
delete_object.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
disconnect_from_device.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
download_to_device.py fix(download_to_device): port login() probe + loginWaitSeconds from connect 2026-04-25 18:40:26 +02:00
ensure_online_connection.py fix(online tools): auto-login + non-CONSTANT version GVL 2026-04-26 19:54:13 +02:00
ensure_project_open.py fix: 4 broken-tool fixes (compile json long, connect_to_device LoginMode, 2026-04-26 16:53:25 +02:00
find_object_by_path.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
get_all_pou_code.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
get_application_state.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
get_compile_messages.py fix(compile): deep-walk message structures with _coerce_for_json before json.dumps 2026-04-28 20:50:15 +02:00
get_pou_code.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
get_project_structure.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
list_project_libraries.py feat(list_project_libraries): capture project compiler version 2026-04-26 19:18:31 +02:00
mirror_export.py fix(mirror): per-project mirror dir name when multiple .project files share a parent 2026-04-27 22:22:09 +02:00
open_project.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
read_running_version_online.py fix(read_running_version_online): document the real root cause + fix 2026-04-26 20:13:25 +02:00
read_variable.py fix(online tools): auto-login + non-CONSTANT version GVL 2026-04-26 19:54:13 +02:00
rename_object.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
save_project.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
set_pou_code.py fix(set_pou_code): omitted declaration/impl no longer wipes the POU 2026-04-26 18:41:48 +02:00
start_stop_application.py fix(online tools): auto-login + non-CONSTANT version GVL 2026-04-26 19:54:13 +02:00
watcher.py fix(watcher): use ASCII-only comments/log strings (IronPython 2.7 syntax error) 2026-04-25 15:10:21 +02:00
write_variable.py fix(online tools): auto-login + non-CONSTANT version GVL 2026-04-26 19:54:13 +02:00