@miadi/stateloom-mcp 0.3.2 → 0.3.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.
Files changed (2) hide show
  1. package/dist/server.js +56 -0
  2. package/package.json +3 -3
package/dist/server.js CHANGED
@@ -784,6 +784,62 @@ function buildServer() {
784
784
  content: [{ type: "text", text: `Added state '${name}' under '${parentName}' (${kind ?? "normal"}).` }],
785
785
  };
786
786
  });
787
+ server.tool("update_state", "Change what a state says about itself without rewriting the machine: its description, its kind (normal, final, history) or its prompt. Omitted fields stay as they are; an empty description or prompt clears it. Use it after a scenario built states in auto mode, to say what each one is.", {
788
+ name: z.string(),
789
+ description: z.string().optional(),
790
+ kind: z.enum(["normal", "final", "history"]).optional(),
791
+ prompt: z.string().optional(),
792
+ }, async ({ name, description, kind, prompt }) => {
793
+ const def = readDef();
794
+ if (!def)
795
+ return { content: [{ type: "text", text: noMachine() }], isError: true };
796
+ const target = findState(def.state, name);
797
+ if (!target)
798
+ return { content: [{ type: "text", text: `State '${name}' not found.` }], isError: true };
799
+ const patch = {};
800
+ const said = [];
801
+ if (description !== undefined) {
802
+ if (description.trim())
803
+ target.description = description;
804
+ else
805
+ delete target.description;
806
+ patch.description = description;
807
+ said.push(description.trim() ? "description" : "description cleared");
808
+ }
809
+ if (kind !== undefined) {
810
+ target.kind = kind;
811
+ patch.kind = kind;
812
+ said.push(`kind ${kind}`);
813
+ }
814
+ if (prompt !== undefined) {
815
+ if (prompt.trim())
816
+ target.prompt = prompt;
817
+ else
818
+ delete target.prompt;
819
+ patch.prompt = prompt.trim() ? prompt : "";
820
+ said.push(prompt.trim() ? "prompt" : "prompt cleared");
821
+ }
822
+ if (!said.length)
823
+ return { content: [{ type: "text", text: `Nothing to change on '${name}': give a description, a kind or a prompt.` }], isError: true };
824
+ writeDef(def);
825
+ bridgeEmitPatch([{ op: "state.update", name, patch }]);
826
+ return { content: [{ type: "text", text: `Updated '${name}': ${said.join(", ")}.` }] };
827
+ });
828
+ server.tool("update_event", "Change an event's description without rewriting the machine. An empty description clears it.", { id: z.string(), description: z.string() }, async ({ id, description }) => {
829
+ const def = readDef();
830
+ if (!def)
831
+ return { content: [{ type: "text", text: noMachine() }], isError: true };
832
+ const event = (def.events ?? []).flatMap((s) => s.events ?? []).find((e) => e.id === id);
833
+ if (!event)
834
+ return { content: [{ type: "text", text: `Event '${id}' not found.` }], isError: true };
835
+ if (description.trim())
836
+ event.description = description;
837
+ else
838
+ delete event.description;
839
+ writeDef(def);
840
+ bridgeEmitPatch([{ op: "event.update", id, patch: { description } }]);
841
+ return { content: [{ type: "text", text: description.trim() ? `Described event '${id}'.` : `Cleared the description of '${id}'.` }] };
842
+ });
787
843
  server.tool("set_prompt", "Say what an agent is asked to resolve while the machine is in a state: the instruction it receives when the state is entered — an opening message, the frame of every later turn. `description` says what the state is and notes are the conversation about it; the prompt is what to do in it. The text replaces what was there; an empty string clears it. Engines and code generation ignore it; get_definition and generate_rispec show it.", { state: z.string(), prompt: z.string() }, async ({ state, prompt }) => {
788
844
  const def = readDef();
789
845
  if (!def)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miadi/stateloom-mcp",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
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",
@@ -38,9 +38,9 @@
38
38
  "node": ">=20"
39
39
  },
40
40
  "dependencies": {
41
- "@miadi/stateloom-cli": "^0.1.3",
41
+ "@miadi/stateloom-cli": "^0.1.4",
42
42
  "@miadi/stateloom-client": "^0.1.3",
43
- "@miadi/stateloom-protocol": "^0.1.11",
43
+ "@miadi/stateloom-protocol": "^0.1.12",
44
44
  "@modelcontextprotocol/sdk": "^1.12.1",
45
45
  "zod": "^4.3.6"
46
46
  },