@miadi/stateloom-mcp 0.3.4 → 0.3.5
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/server.js +20 -0
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -785,6 +785,26 @@ function buildServer() {
|
|
|
785
785
|
content: [{ type: "text", text: `Added state '${name}' under '${parentName}' (${kind ?? "normal"}).` }],
|
|
786
786
|
};
|
|
787
787
|
});
|
|
788
|
+
server.tool("remove_transition", "Remove a state's transitions on an event — only those to `nextState` when it is given (use \"\" for a transition that stays). Everything else on the state is kept. Says how many were removed.", { state: z.string(), event: z.string(), nextState: z.string().optional() }, async ({ state, event, nextState }) => {
|
|
789
|
+
const def = readDef();
|
|
790
|
+
if (!def)
|
|
791
|
+
return { content: [{ type: "text", text: noMachine() }], isError: true };
|
|
792
|
+
const target = findState(def.state, state);
|
|
793
|
+
if (!target)
|
|
794
|
+
return { content: [{ type: "text", text: `State '${state}' not found.` }], isError: true };
|
|
795
|
+
const all = target.transitions ?? [];
|
|
796
|
+
const matches = (t) => t.event === event && (nextState === undefined || (nextState === "" ? !t.nextState : t.nextState === nextState));
|
|
797
|
+
const indices = all.map((t, i) => (matches(t) ? i : -1)).filter((i) => i >= 0);
|
|
798
|
+
if (!indices.length) {
|
|
799
|
+
const have = all.map((t) => `${t.event}${t.nextState ? ` → ${t.nextState}` : " (stays)"}`).join(", ") || "none";
|
|
800
|
+
return { content: [{ type: "text", text: `No transition on '${event}'${nextState === undefined ? "" : ` to '${nextState || "(stays)"}'`} from '${state}'. It has: ${have}.` }], isError: true };
|
|
801
|
+
}
|
|
802
|
+
target.transitions = all.filter((t) => !matches(t));
|
|
803
|
+
writeDef(def);
|
|
804
|
+
// Positional ops, highest index first, so each index still names the right one.
|
|
805
|
+
bridgeEmitPatch([...indices].reverse().map((index) => ({ op: "transition.remove", state, index })));
|
|
806
|
+
return { content: [{ type: "text", text: `Removed ${indices.length} transition(s) on '${event}' from '${state}'.` }] };
|
|
807
|
+
});
|
|
788
808
|
server.tool("add_object", "Declare an object the machine is constructed with: `instance` is the name guards use (`walk` in `walk.state`), `class` is its type — an ERD entity when it is data. Fixes L001/L003 without rewriting the machine. Refused when the instance already exists.", { instance: z.string(), class: z.string() }, async ({ instance, class: className }) => {
|
|
789
809
|
const def = readDef();
|
|
790
810
|
if (!def)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miadi/stateloom-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "MCP server for miadi-stateloom (formerly smcraft-mcp) — lets LLM agents design state machines through conversation",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@miadi/stateloom-cli": "^0.1.4",
|
|
42
42
|
"@miadi/stateloom-client": "^0.1.3",
|
|
43
|
-
"@miadi/stateloom-protocol": "^0.1.
|
|
43
|
+
"@miadi/stateloom-protocol": "^0.1.14",
|
|
44
44
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
45
45
|
"zod": "^4.3.6"
|
|
46
46
|
},
|