@codesys/mcp-toolkit 2.1.1 → 2.1.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.1.2] - 2026-11-13
9
+
10
+ ### Fixed
11
+ - `get_devices` really shows Machine Expert modules by their module id. 2.1.1
12
+ expected `get_module_identification()` to return an object, but in CODESYS
13
+ and Machine Expert 2.3 it returns the module id as a string (empty for a
14
+ device that isn't a module), so the module id was never read.
15
+
8
16
  ## [2.1.1] - 2026-11-13
9
17
 
10
18
  ### Fixed
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { McpServer } from "@modelcontextprotocol/server";
2
2
  import { type AppContext } from "./tools.js";
3
- export declare const VERSION = "2.1.1";
3
+ export declare const VERSION = "2.1.2";
4
4
  export declare function createServer(ctx: AppContext): McpServer;
5
5
  export type { AppContext };
package/dist/server.js CHANGED
@@ -3,7 +3,7 @@ import { EXTENSION_ID } from "@modelcontextprotocol/ext-apps/server";
3
3
  import { currentCodesysSim } from "./codesys/simulation.js";
4
4
  import { registerTools, revertObject, versionLine } from "./tools.js";
5
5
  import { registerPanel } from "./panel.js";
6
- export const VERSION = "2.1.1";
6
+ export const VERSION = "2.1.2";
7
7
  const INSTRUCTIONS = `CODESYS V3.5 automation through a persistent CODESYS session.
8
8
  Everything goes through the one tool named codesys, as {"action": "<name>", "args": {...}}. The names below are its actions; {"action": "help"} lists them all with their arguments.
9
9
  Use batch whenever you know the next steps: it sends several actions in one call and is much faster than separate calls. For example, all the create_object and write_object calls of a step followed by compile, or codesys_sim_force, wait, codesys_sim_cycle and codesys_sim_read for one test.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesys/mcp-toolkit",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "MCP server for CODESYS V3.5: read, write, compile and simulate Structured Text through a persistent CODESYS session",
5
5
  "mcpName": "io.github.johannesPettersson80/codesys-mcp-toolkit",
6
6
  "type": "module",
@@ -10,7 +10,7 @@ import sys
10
10
 
11
11
  import scriptengine as se
12
12
 
13
- from mcp_compat import PY2, to_text
13
+ from mcp_compat import PY2, string_types, to_text
14
14
 
15
15
 
16
16
  class OpError(Exception):
@@ -840,9 +840,13 @@ def op_devices_list(args):
840
840
  ident = _safe(lambda: ch.get_device_identification())
841
841
  # A module (a device that exists only inside its owner, such as Machine Expert's
842
842
  # local I/O and embedded functions) reports its owner's type and id; its module
843
- # id is what tells it apart.
843
+ # id is what tells it apart. get_module_identification() returns that id as a
844
+ # string, empty for a device that isn't a module (CODESYS and Machine Expert 2.3,
845
+ # Scripting 4.1). Schneider's DeviceIdDto carries it as module_id instead.
844
846
  mod = _safe(lambda: ch.get_module_identification())
845
- module = to_text(_safe(lambda: mod.module_id)) if mod is not None else ""
847
+ if mod is not None and not isinstance(mod, string_types):
848
+ mod = _safe(lambda: mod.module_id)
849
+ module = (to_text(mod) or "").strip() if mod is not None else ""
846
850
  info = {
847
851
  "path": "/".join(names + [nm]),
848
852
  "name": nm,