@modudraft/mcp 0.4.0 → 0.4.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.
- package/dist/index.js +102 -0
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -25149,6 +25149,108 @@ var ALL_TOOLS = [
|
|
|
25149
25149
|
return { ok: true, messagesCreated: count };
|
|
25150
25150
|
}
|
|
25151
25151
|
},
|
|
25152
|
+
// ── Sequence fragments ───────────────────────────────────────────────────
|
|
25153
|
+
{
|
|
25154
|
+
name: "add_sequence_fragment",
|
|
25155
|
+
description: 'Wrap a group of sequence messages in a fragment box (loop, alt, opt, or par). Use message_ids to list the message IDs that fall inside the fragment. kind: "loop" for repetition, "alt" for conditional branches, "opt" for optional, "par" for parallel.',
|
|
25156
|
+
inputSchema: {
|
|
25157
|
+
type: "object",
|
|
25158
|
+
properties: {
|
|
25159
|
+
diagram_id: { type: "string" },
|
|
25160
|
+
kind: {
|
|
25161
|
+
type: "string",
|
|
25162
|
+
enum: ["loop", "alt", "opt", "par"],
|
|
25163
|
+
description: "Fragment kind"
|
|
25164
|
+
},
|
|
25165
|
+
condition: {
|
|
25166
|
+
type: "string",
|
|
25167
|
+
description: 'Guard condition label shown on the fragment (e.g. "valid credentials", "for each item")'
|
|
25168
|
+
},
|
|
25169
|
+
message_ids: {
|
|
25170
|
+
type: "array",
|
|
25171
|
+
items: { type: "string" },
|
|
25172
|
+
description: "Ordered list of sequence message IDs to include in this fragment"
|
|
25173
|
+
}
|
|
25174
|
+
},
|
|
25175
|
+
required: ["diagram_id", "kind", "condition", "message_ids"]
|
|
25176
|
+
},
|
|
25177
|
+
async handler(args) {
|
|
25178
|
+
const id = diagramId(args);
|
|
25179
|
+
let frag;
|
|
25180
|
+
await mutateDiagram(id, (entry) => {
|
|
25181
|
+
if (!Array.isArray(entry.sequenceFragments)) entry.sequenceFragments = [];
|
|
25182
|
+
const f = {
|
|
25183
|
+
id: genId(),
|
|
25184
|
+
kind: str(args.kind, "opt"),
|
|
25185
|
+
condition: str(args.condition),
|
|
25186
|
+
messageIds: Array.isArray(args.message_ids) ? args.message_ids : []
|
|
25187
|
+
};
|
|
25188
|
+
entry.sequenceFragments.push(f);
|
|
25189
|
+
frag = f;
|
|
25190
|
+
});
|
|
25191
|
+
return frag;
|
|
25192
|
+
}
|
|
25193
|
+
},
|
|
25194
|
+
{
|
|
25195
|
+
name: "update_sequence_fragment",
|
|
25196
|
+
description: "Update an existing sequence fragment \u2014 change its kind, condition label, or the set of enclosed message IDs.",
|
|
25197
|
+
inputSchema: {
|
|
25198
|
+
type: "object",
|
|
25199
|
+
properties: {
|
|
25200
|
+
diagram_id: { type: "string" },
|
|
25201
|
+
fragment_id: { type: "string", description: "ID of the fragment to update" },
|
|
25202
|
+
kind: { type: "string", enum: ["loop", "alt", "opt", "par"] },
|
|
25203
|
+
condition: { type: "string" },
|
|
25204
|
+
message_ids: { type: "array", items: { type: "string" } }
|
|
25205
|
+
},
|
|
25206
|
+
required: ["diagram_id", "fragment_id"]
|
|
25207
|
+
},
|
|
25208
|
+
async handler(args) {
|
|
25209
|
+
const id = diagramId(args);
|
|
25210
|
+
let found = false;
|
|
25211
|
+
await mutateDiagram(id, (entry) => {
|
|
25212
|
+
if (!Array.isArray(entry.sequenceFragments)) return;
|
|
25213
|
+
entry.sequenceFragments = entry.sequenceFragments.map((f) => {
|
|
25214
|
+
const frag = f;
|
|
25215
|
+
if (frag.id !== str(args.fragment_id)) return frag;
|
|
25216
|
+
found = true;
|
|
25217
|
+
return {
|
|
25218
|
+
...frag,
|
|
25219
|
+
...args.kind !== void 0 && { kind: str(args.kind) },
|
|
25220
|
+
...args.condition !== void 0 && { condition: str(args.condition) },
|
|
25221
|
+
...Array.isArray(args.message_ids) && { messageIds: args.message_ids }
|
|
25222
|
+
};
|
|
25223
|
+
});
|
|
25224
|
+
});
|
|
25225
|
+
if (!found) throw new Error(`Fragment ${args.fragment_id} not found`);
|
|
25226
|
+
return { ok: true };
|
|
25227
|
+
}
|
|
25228
|
+
},
|
|
25229
|
+
{
|
|
25230
|
+
name: "delete_sequence_fragment",
|
|
25231
|
+
description: "Remove a sequence fragment box. The enclosed messages remain; only the fragment wrapper is deleted.",
|
|
25232
|
+
inputSchema: {
|
|
25233
|
+
type: "object",
|
|
25234
|
+
properties: {
|
|
25235
|
+
diagram_id: { type: "string" },
|
|
25236
|
+
fragment_id: { type: "string" }
|
|
25237
|
+
},
|
|
25238
|
+
required: ["diagram_id", "fragment_id"]
|
|
25239
|
+
},
|
|
25240
|
+
async handler(args) {
|
|
25241
|
+
const id = diagramId(args);
|
|
25242
|
+
let removed = false;
|
|
25243
|
+
await mutateDiagram(id, (entry) => {
|
|
25244
|
+
if (!Array.isArray(entry.sequenceFragments)) return;
|
|
25245
|
+
const before = entry.sequenceFragments.length;
|
|
25246
|
+
entry.sequenceFragments = entry.sequenceFragments.filter(
|
|
25247
|
+
(f) => f.id !== str(args.fragment_id)
|
|
25248
|
+
);
|
|
25249
|
+
removed = entry.sequenceFragments.length < before;
|
|
25250
|
+
});
|
|
25251
|
+
return { ok: removed };
|
|
25252
|
+
}
|
|
25253
|
+
},
|
|
25152
25254
|
// ── DB schema (ER diagram) ───────────────────────────────────────────────
|
|
25153
25255
|
{
|
|
25154
25256
|
name: "add_db_table",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modudraft/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "MCP server for Modudraft — create and edit system-design diagrams via AI (cloud edition)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "tsup && node -e \"const fs=require('fs');fs.chmodSync('dist/index.js','755')\"",
|
|
11
11
|
"typecheck": "tsc --noEmit",
|
|
12
|
-
"dev": "tsup --watch"
|
|
12
|
+
"dev": "tsup --watch",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest"
|
|
13
15
|
},
|
|
14
16
|
"files": [
|
|
15
17
|
"dist",
|
|
@@ -20,8 +22,9 @@
|
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"@modudraft/core": "*",
|
|
23
|
-
"@types/node": "^
|
|
25
|
+
"@types/node": "^26.0.0",
|
|
24
26
|
"tsup": "^8.5.0",
|
|
25
|
-
"typescript": "~5.8.0"
|
|
27
|
+
"typescript": "~5.8.0",
|
|
28
|
+
"vitest": "^4.0.0"
|
|
26
29
|
}
|
|
27
30
|
}
|