@markasso/mcp 0.10.1 → 0.10.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/README.md +1 -1
- package/dist/markasso-mcp.js +216 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,7 +136,7 @@ Icons are named `<pack>/<icon>`, like `aws/amazon-ec2` or `aws/aws-lambda`; `ico
|
|
|
136
136
|
|
|
137
137
|
## Live mode
|
|
138
138
|
|
|
139
|
-
1. In Markasso, choose **Start live session** at the top right: the live link is copied to the clipboard. Or, once the session is running, choose **Invite AI agent
|
|
139
|
+
1. In Markasso, choose **Start live session** at the top right: the live link is copied to the clipboard. Or, once the session is running, choose **People → Invite AI agent** to copy a ready-made prompt with the link.
|
|
140
140
|
2. Ask the agent to `live_join` it. If the room already has content, it becomes the agent's current diagram; if it is empty, the agent's diagram is published to it.
|
|
141
141
|
3. Every change the agent makes is applied for everyone in the room; changes made by people show up when the agent calls `diagram_read`.
|
|
142
142
|
4. People in the room who have a Markasso Cloud licence stored in the app see an **Ask** button next to the agent in the participant list. Their requests reach the agent at the end of its next tool result, or through `live_wait_request` while it waits; `live_reply` sends an answer that shows up under the agent's name. Without a licence the button does not appear and the room refuses the request.
|
package/dist/markasso-mcp.js
CHANGED
|
@@ -1989,6 +1989,11 @@ function getBundledIcon(ref) {
|
|
|
1989
1989
|
});
|
|
1990
1990
|
return null;
|
|
1991
1991
|
}
|
|
1992
|
+
/** Icons of a pack if already loaded (no load is triggered). */
|
|
1993
|
+
function getLoadedPack(pack) {
|
|
1994
|
+
const icons = loaded.get(pack);
|
|
1995
|
+
return icons ? [...icons.values()] : null;
|
|
1996
|
+
}
|
|
1992
1997
|
//#endregion
|
|
1993
1998
|
//#region ../src/io/agent_requests_protocol.ts
|
|
1994
1999
|
/** Longest reply text an agent can send back. */
|
|
@@ -4210,6 +4215,7 @@ function getElementBorderPoint(el, targetX, targetY) {
|
|
|
4210
4215
|
function clamp$1(n, min, max) {
|
|
4211
4216
|
return Math.max(min, Math.min(max, n));
|
|
4212
4217
|
}
|
|
4218
|
+
/** Rotates (x, y) by `angle` radians around (cx, cy). */
|
|
4213
4219
|
function rotatePoint(x, y, cx, cy, angle) {
|
|
4214
4220
|
const dx = x - cx;
|
|
4215
4221
|
const dy = y - cy;
|
|
@@ -5747,7 +5753,7 @@ function escapeXml(str) {
|
|
|
5747
5753
|
}
|
|
5748
5754
|
//#endregion
|
|
5749
5755
|
//#region package.json
|
|
5750
|
-
var version = "0.10.
|
|
5756
|
+
var version = "0.10.3";
|
|
5751
5757
|
//#endregion
|
|
5752
5758
|
//#region ../src/core/layout.ts
|
|
5753
5759
|
/** Space kept on both sides of a label between ranks. */
|
|
@@ -6399,7 +6405,8 @@ function reducer(scene, command, isRemote = false) {
|
|
|
6399
6405
|
const isDrawingTool = !(/* @__PURE__ */ new Set([
|
|
6400
6406
|
"select",
|
|
6401
6407
|
"hand",
|
|
6402
|
-
"eraser"
|
|
6408
|
+
"eraser",
|
|
6409
|
+
"laser"
|
|
6403
6410
|
])).has(command.tool);
|
|
6404
6411
|
const leavingText = scene.appState.activeTool === "text" && command.tool !== "text";
|
|
6405
6412
|
let newAppState = {
|
|
@@ -6774,6 +6781,18 @@ function composeChange(into, step) {
|
|
|
6774
6781
|
} : step.order;
|
|
6775
6782
|
}
|
|
6776
6783
|
/**
|
|
6784
|
+
* Whether a composed change leaves every element as it found it, e.g. a drag
|
|
6785
|
+
* that ends exactly where it began (easy once moves snap): no undo step.
|
|
6786
|
+
*/
|
|
6787
|
+
function isNoopChange(change) {
|
|
6788
|
+
if (change.order && !deepEqual(change.order.before, change.order.after)) return false;
|
|
6789
|
+
for (const delta of change.elements.values()) {
|
|
6790
|
+
if (delta.before === null !== (delta.after === null)) return false;
|
|
6791
|
+
for (const field of delta.fields.values()) if (!deepEqual(field.before, field.after)) return false;
|
|
6792
|
+
}
|
|
6793
|
+
return true;
|
|
6794
|
+
}
|
|
6795
|
+
/**
|
|
6777
6796
|
* After composing several steps, each delta's indices are relative to the
|
|
6778
6797
|
* intermediate scene of its own step (e.g. two elements erased in one drag
|
|
6779
6798
|
* both report index 0). Re-anchor them to the scenes around the whole change
|
|
@@ -6937,7 +6956,7 @@ var History = class {
|
|
|
6937
6956
|
const drag = this.drag;
|
|
6938
6957
|
if (!drag) return;
|
|
6939
6958
|
this.drag = null;
|
|
6940
|
-
if (!drag.touched) {
|
|
6959
|
+
if (!drag.touched || isNoopChange(drag.change)) {
|
|
6941
6960
|
this.future = drag.future;
|
|
6942
6961
|
if (drag.future.length > 0) this.notify();
|
|
6943
6962
|
return;
|
|
@@ -8828,7 +8847,37 @@ var Diagram = class {
|
|
|
8828
8847
|
}
|
|
8829
8848
|
await Promise.all([...packs].map((p) => loadBundledPack(p)));
|
|
8830
8849
|
}
|
|
8850
|
+
/**
|
|
8851
|
+
* Icon nodes whose built-in reference draws only a dashed placeholder.
|
|
8852
|
+
* `pack-not-loaded`: a pack that is not built in. An imported pack's icons
|
|
8853
|
+
* are embedded, so a reference into one means the pack was not loaded
|
|
8854
|
+
* when the node was made. `unknown-icon`: a generic or bundled icon that
|
|
8855
|
+
* does not exist. Bundled packs must be loaded first
|
|
8856
|
+
* (`loadUsedIconPacks`); one that is not is not judged.
|
|
8857
|
+
*/
|
|
8858
|
+
unresolvedIcons() {
|
|
8859
|
+
const keys = this.nodeKeys();
|
|
8860
|
+
const found = [];
|
|
8861
|
+
for (const el of this.elements) {
|
|
8862
|
+
if (el.type !== "stencil" || el.source.kind !== "builtin") continue;
|
|
8863
|
+
const reason = unresolvedReason(el.source.ref);
|
|
8864
|
+
if (reason) found.push({
|
|
8865
|
+
node: keys.get(el.id) ?? el.id,
|
|
8866
|
+
ref: el.source.ref,
|
|
8867
|
+
reason
|
|
8868
|
+
});
|
|
8869
|
+
}
|
|
8870
|
+
return found;
|
|
8871
|
+
}
|
|
8831
8872
|
};
|
|
8873
|
+
/** Why a built-in reference draws no icon, or null when it draws one. */
|
|
8874
|
+
function unresolvedReason(ref) {
|
|
8875
|
+
const [pack = "", id = ""] = ref.split("/");
|
|
8876
|
+
if (pack === "generic") return genericIconIdOf(ref) === null ? "unknown-icon" : null;
|
|
8877
|
+
if (!isBundledPack(pack)) return "pack-not-loaded";
|
|
8878
|
+
const icons = getLoadedPack(pack);
|
|
8879
|
+
return icons === null || icons.some((icon) => icon.id === id) ? null : "unknown-icon";
|
|
8880
|
+
}
|
|
8832
8881
|
/** Size a labeled node of this kind takes when created without one. */
|
|
8833
8882
|
function labelSize(kind, label, defaults, fontSize) {
|
|
8834
8883
|
if (kind === "text" || kind === "icon") return defaults;
|
|
@@ -8845,6 +8894,10 @@ function autoSizeOf(el) {
|
|
|
8845
8894
|
default: return null;
|
|
8846
8895
|
}
|
|
8847
8896
|
}
|
|
8897
|
+
/** Error for a reference into an imported pack that is not loaded. */
|
|
8898
|
+
function unloadedPackMessage(pack) {
|
|
8899
|
+
return `Icon pack "${pack}" is not loaded. Load it with icons_import, then use icons_search. Imported packs last until the server stops: list the pack in MARKASSO_ICON_PACKS to keep it across restarts.`;
|
|
8900
|
+
}
|
|
8848
8901
|
/**
|
|
8849
8902
|
* The built-in reference for an icon, or null when no built-in icon has
|
|
8850
8903
|
* that name. Throws on a malformed or unknown built-in reference.
|
|
@@ -8852,10 +8905,11 @@ function autoSizeOf(el) {
|
|
|
8852
8905
|
async function findBuiltinRef(input) {
|
|
8853
8906
|
const raw = input.trim();
|
|
8854
8907
|
if (raw.includes("/")) {
|
|
8908
|
+
const [pack = ""] = raw.split("/");
|
|
8909
|
+
if (pack !== "generic" && !isBundledPack(pack)) throw new DiagramError(unloadedPackMessage(pack));
|
|
8855
8910
|
if (!isValidStencilRef(raw)) throw new DiagramError(`Invalid icon reference "${raw}".`);
|
|
8856
|
-
const [pack] = raw.split("/");
|
|
8857
8911
|
if (pack === "generic" && !genericIconIdOf(raw)) throw new DiagramError(`Unknown icon "${raw}". Use icons_search.`);
|
|
8858
|
-
if (
|
|
8912
|
+
if (isBundledPack(pack)) {
|
|
8859
8913
|
await loadBundledPack(pack);
|
|
8860
8914
|
if (!getBundledIcon(raw)) throw new DiagramError(`Unknown icon "${raw}". Use icons_search.`);
|
|
8861
8915
|
}
|
|
@@ -9105,6 +9159,79 @@ function isValidSessionCommand(value) {
|
|
|
9105
9159
|
if (!Object.hasOwn(CHECKS, value.type)) return false;
|
|
9106
9160
|
return CHECKS[value.type](value);
|
|
9107
9161
|
}
|
|
9162
|
+
/**
|
|
9163
|
+
* How late the timeout check may run before it counts as a wake from sleep
|
|
9164
|
+
* (timers do not run while a machine or a background tab sleeps, and run
|
|
9165
|
+
* late in a throttled one): the old ping then proves nothing, and a fresh
|
|
9166
|
+
* one gets a full timeout. Only a check that runs on time can give up.
|
|
9167
|
+
*/
|
|
9168
|
+
var SLEEP_SLACK_MS = 5e3;
|
|
9169
|
+
/** Pings one socket on a period and reports when it stops answering. */
|
|
9170
|
+
var Heartbeat = class {
|
|
9171
|
+
options;
|
|
9172
|
+
intervalMs;
|
|
9173
|
+
timeoutMs;
|
|
9174
|
+
now;
|
|
9175
|
+
nextPing = null;
|
|
9176
|
+
deadline = null;
|
|
9177
|
+
pingSentAt = 0;
|
|
9178
|
+
stopped = true;
|
|
9179
|
+
constructor(options) {
|
|
9180
|
+
this.options = options;
|
|
9181
|
+
this.intervalMs = options.intervalMs ?? 2e4;
|
|
9182
|
+
this.timeoutMs = options.timeoutMs ?? 1e4;
|
|
9183
|
+
this.now = options.now ?? Date.now;
|
|
9184
|
+
}
|
|
9185
|
+
/** Starts, or restarts, the period. */
|
|
9186
|
+
start() {
|
|
9187
|
+
this.stop();
|
|
9188
|
+
this.stopped = false;
|
|
9189
|
+
this.armPing();
|
|
9190
|
+
}
|
|
9191
|
+
/** The socket answered: the next ping waits a full period. */
|
|
9192
|
+
pong() {
|
|
9193
|
+
if (this.stopped) return;
|
|
9194
|
+
this.clear("deadline");
|
|
9195
|
+
this.armPing();
|
|
9196
|
+
}
|
|
9197
|
+
stop() {
|
|
9198
|
+
this.stopped = true;
|
|
9199
|
+
this.clear("nextPing");
|
|
9200
|
+
this.clear("deadline");
|
|
9201
|
+
}
|
|
9202
|
+
armPing() {
|
|
9203
|
+
this.clear("nextPing");
|
|
9204
|
+
this.nextPing = unref(setTimeout(() => this.ping(), this.intervalMs));
|
|
9205
|
+
}
|
|
9206
|
+
ping() {
|
|
9207
|
+
if (this.stopped) return;
|
|
9208
|
+
this.nextPing = null;
|
|
9209
|
+
this.pingSentAt = this.now();
|
|
9210
|
+
this.options.ping();
|
|
9211
|
+
this.clear("deadline");
|
|
9212
|
+
this.deadline = unref(setTimeout(() => this.check(), this.timeoutMs));
|
|
9213
|
+
}
|
|
9214
|
+
check() {
|
|
9215
|
+
if (this.stopped) return;
|
|
9216
|
+
this.deadline = null;
|
|
9217
|
+
if (this.now() - this.pingSentAt - this.timeoutMs > SLEEP_SLACK_MS) {
|
|
9218
|
+
this.ping();
|
|
9219
|
+
return;
|
|
9220
|
+
}
|
|
9221
|
+
this.stop();
|
|
9222
|
+
this.options.onTimeout();
|
|
9223
|
+
}
|
|
9224
|
+
clear(which) {
|
|
9225
|
+
const timer = this[which];
|
|
9226
|
+
if (timer) clearTimeout(timer);
|
|
9227
|
+
this[which] = null;
|
|
9228
|
+
}
|
|
9229
|
+
};
|
|
9230
|
+
/** In Node, a timer must not keep the process alive on its own. */
|
|
9231
|
+
function unref(timer) {
|
|
9232
|
+
timer.unref?.();
|
|
9233
|
+
return timer;
|
|
9234
|
+
}
|
|
9108
9235
|
//#endregion
|
|
9109
9236
|
//#region ../src/io/live_outbox.ts
|
|
9110
9237
|
var LiveOutbox = class {
|
|
@@ -9388,6 +9515,8 @@ var CLOSE_LICENCE_REQUIRED = 4402;
|
|
|
9388
9515
|
var CLOSE_ROOM_FULL = 1013;
|
|
9389
9516
|
/** Close code (with reason "replaced") for a socket a newer one replaced. */
|
|
9390
9517
|
var CLOSE_REPLACED = 1e3;
|
|
9518
|
+
/** How long a socket given up on may take to report its close. */
|
|
9519
|
+
var CLOSE_WAIT_MS = 2e3;
|
|
9391
9520
|
var RECONNECT_BASE_MS = 1e3;
|
|
9392
9521
|
var RECONNECT_MAX_MS = 1e4;
|
|
9393
9522
|
/**
|
|
@@ -9498,6 +9627,8 @@ var LiveLink = class LiveLink {
|
|
|
9498
9627
|
dropClose = null;
|
|
9499
9628
|
/** One-shot notes for the model's next tool answer (see takeNotices). */
|
|
9500
9629
|
notices = [];
|
|
9630
|
+
/** Watches the socket in the room, when the room answers pings. */
|
|
9631
|
+
heartbeat = null;
|
|
9501
9632
|
inbox = [];
|
|
9502
9633
|
/**
|
|
9503
9634
|
* Delivered request ids the agent may answer, each with the elements the
|
|
@@ -9846,7 +9977,9 @@ var LiveLink = class LiveLink {
|
|
|
9846
9977
|
settled = true;
|
|
9847
9978
|
clearTimeout(timer);
|
|
9848
9979
|
resolve(onInit(msg));
|
|
9849
|
-
|
|
9980
|
+
if (msg.heartbeat === true) this.watch(socket, attempt);
|
|
9981
|
+
} else if (msg.type === "pong") this.heartbeat?.pong();
|
|
9982
|
+
else if (msg.type === "apply") {
|
|
9850
9983
|
if (!admitted) return;
|
|
9851
9984
|
if (isSessionCommand(msg.command) && isValidSessionCommand(msg.command)) try {
|
|
9852
9985
|
this.diagram.history.applyRemote(msg.command);
|
|
@@ -9925,8 +10058,42 @@ var LiveLink = class LiveLink {
|
|
|
9925
10058
|
discarded
|
|
9926
10059
|
};
|
|
9927
10060
|
}
|
|
10061
|
+
/**
|
|
10062
|
+
* Pings the socket of this attempt while it is in the room. No answer in
|
|
10063
|
+
* time means the connection died without a close event: it is dropped
|
|
10064
|
+
* right away, as a close would (its own late events no longer count),
|
|
10065
|
+
* instead of waiting for a close that may take long to come.
|
|
10066
|
+
*/
|
|
10067
|
+
watch(socket, attempt) {
|
|
10068
|
+
this.heartbeat?.stop();
|
|
10069
|
+
this.heartbeat = new Heartbeat({
|
|
10070
|
+
ping: () => {
|
|
10071
|
+
if (attempt === this.attemptId) this.send({ type: "ping" });
|
|
10072
|
+
},
|
|
10073
|
+
onTimeout: () => {
|
|
10074
|
+
if (attempt !== this.attemptId || this._state !== "connected") return;
|
|
10075
|
+
try {
|
|
10076
|
+
socket.close();
|
|
10077
|
+
} catch {}
|
|
10078
|
+
setTimeout(() => {
|
|
10079
|
+
if (attempt !== this.attemptId || this._state !== "connected") return;
|
|
10080
|
+
this.attemptId++;
|
|
10081
|
+
this.dropped({
|
|
10082
|
+
code: null,
|
|
10083
|
+
reason: "heartbeat timeout"
|
|
10084
|
+
});
|
|
10085
|
+
}, CLOSE_WAIT_MS).unref?.();
|
|
10086
|
+
}
|
|
10087
|
+
});
|
|
10088
|
+
this.heartbeat.start();
|
|
10089
|
+
}
|
|
10090
|
+
stopWatching() {
|
|
10091
|
+
this.heartbeat?.stop();
|
|
10092
|
+
this.heartbeat = null;
|
|
10093
|
+
}
|
|
9928
10094
|
/** The socket of a joined session closed: retry unless it is final. */
|
|
9929
10095
|
dropped(close) {
|
|
10096
|
+
this.stopWatching();
|
|
9930
10097
|
this._lastClose = close;
|
|
9931
10098
|
this.dropClose = close;
|
|
9932
10099
|
this.outbox.clear();
|
|
@@ -9974,6 +10141,7 @@ var LiveLink = class LiveLink {
|
|
|
9974
10141
|
}
|
|
9975
10142
|
/** Gives up on the room: waiting calls return, nothing is sent anymore. */
|
|
9976
10143
|
lose() {
|
|
10144
|
+
this.stopWatching();
|
|
9977
10145
|
this._state = "lost";
|
|
9978
10146
|
this.cancelReconnect();
|
|
9979
10147
|
this.untrack();
|
|
@@ -9998,6 +10166,7 @@ var LiveLink = class LiveLink {
|
|
|
9998
10166
|
leave() {
|
|
9999
10167
|
if (this.open) this.outbox.drain();
|
|
10000
10168
|
this._state = "left";
|
|
10169
|
+
this.stopWatching();
|
|
10001
10170
|
this.attemptId++;
|
|
10002
10171
|
this.cancelReconnect();
|
|
10003
10172
|
this.wakeWaiters();
|
|
@@ -10177,11 +10346,8 @@ function listed(items) {
|
|
|
10177
10346
|
const rest = items.length - MAX_LISTED;
|
|
10178
10347
|
return rest > 0 ? `${shown}; and ${rest} more` : shown;
|
|
10179
10348
|
}
|
|
10180
|
-
/**
|
|
10181
|
-
|
|
10182
|
-
* an empty string when the diagram is clear.
|
|
10183
|
-
*/
|
|
10184
|
-
function formatWarnings(w) {
|
|
10349
|
+
/** One line per kind of geometric problem, each with a hint. */
|
|
10350
|
+
function warningLines(w) {
|
|
10185
10351
|
const lines = [];
|
|
10186
10352
|
if (w.throughNodes.length > 0) {
|
|
10187
10353
|
const byEdge = /* @__PURE__ */ new Map();
|
|
@@ -10202,11 +10368,38 @@ function formatWarnings(w) {
|
|
|
10202
10368
|
lines.push(`- Crossing connections (${total}): ${listed(w.crossings.map((c) => `${edgeText(c.a)} x ${edgeText(c.b)}`))}. Hint: ${hint}.`);
|
|
10203
10369
|
}
|
|
10204
10370
|
if (w.nodeOverlaps.length > 0) lines.push(`- Overlapping nodes: ${listed(w.nodeOverlaps.map(([a, b]) => `${a} and ${b}`))}. Hint: run diagram_layout, or move them (diagram_update x/y).`);
|
|
10371
|
+
return lines;
|
|
10372
|
+
}
|
|
10373
|
+
/** Warning lines as one block, or an empty string when there are none. */
|
|
10374
|
+
function warningsBlock(lines) {
|
|
10205
10375
|
return lines.length > 0 ? `Warnings:\n${lines.join("\n")}` : "";
|
|
10206
10376
|
}
|
|
10377
|
+
/**
|
|
10378
|
+
* Icon nodes drawn as dashed placeholders, one line per cause: a pack not
|
|
10379
|
+
* loaded can be imported again, a built-in icon that does not exist cannot.
|
|
10380
|
+
* Re-creating a node drops its connections, so the hint says to redo them.
|
|
10381
|
+
*/
|
|
10382
|
+
function missingIconLines(missing) {
|
|
10383
|
+
const text = (items) => listed(items.map((m) => `${m.node} (${m.ref})`));
|
|
10384
|
+
const notLoaded = missing.filter((m) => m.reason === "pack-not-loaded");
|
|
10385
|
+
const unknown = missing.filter((m) => m.reason === "unknown-icon");
|
|
10386
|
+
const lines = [];
|
|
10387
|
+
if (notLoaded.length > 0) lines.push(`- Icon pack not loaded, icons drawn as dashed boxes: ${text(notLoaded)}. Hint: load the pack with icons_import, then re-create these nodes (diagram_remove, diagram_add_nodes) and their connections (diagram_connect).`);
|
|
10388
|
+
if (unknown.length > 0) lines.push(`- Unknown icons, drawn as dashed boxes: ${text(unknown)}. Hint: pick an existing icon with icons_search, then re-create these nodes (diagram_remove, diagram_add_nodes) and their connections (diagram_connect).`);
|
|
10389
|
+
return lines;
|
|
10390
|
+
}
|
|
10391
|
+
/**
|
|
10392
|
+
* All warnings of a diagram: missing icons first, then the geometry. Loads
|
|
10393
|
+
* the bundled icon packs the board uses, so a missing icon is reported the
|
|
10394
|
+
* same whichever tool runs first.
|
|
10395
|
+
*/
|
|
10396
|
+
async function diagramWarnings(diagram) {
|
|
10397
|
+
await diagram.loadUsedIconPacks();
|
|
10398
|
+
return warningsBlock([...missingIconLines(diagram.unresolvedIcons()), ...warningLines(findWarnings(diagram))]);
|
|
10399
|
+
}
|
|
10207
10400
|
/** Warnings of the current diagram as text to append to a tool result. */
|
|
10208
|
-
function warningsSuffix(diagram) {
|
|
10209
|
-
const text =
|
|
10401
|
+
async function warningsSuffix(diagram) {
|
|
10402
|
+
const text = await diagramWarnings(diagram);
|
|
10210
10403
|
return text ? `\n${text}` : "";
|
|
10211
10404
|
}
|
|
10212
10405
|
//#endregion
|
|
@@ -10251,8 +10444,9 @@ async function exportPng(diagram, options) {
|
|
|
10251
10444
|
text: "The diagram is empty: nothing to export."
|
|
10252
10445
|
}];
|
|
10253
10446
|
const png = svgToPng(svg);
|
|
10447
|
+
const warnings = await diagramWarnings(diagram);
|
|
10254
10448
|
if (path) await writeFileAtomic(path, png);
|
|
10255
|
-
const notes = [path ? `Saved PNG to ${path}.` : "",
|
|
10449
|
+
const notes = [path ? `Saved PNG to ${path}.` : "", warnings].filter(Boolean);
|
|
10256
10450
|
return [...returnImage ? [{
|
|
10257
10451
|
type: "image",
|
|
10258
10452
|
data: png.toString("base64"),
|
|
@@ -10498,9 +10692,10 @@ server.registerTool("diagram_read", {
|
|
|
10498
10692
|
description: "Describe the current diagram: nodes (key, kind, label, position, size), connections and layout warnings.",
|
|
10499
10693
|
inputSchema: {},
|
|
10500
10694
|
annotations: { readOnlyHint: true }
|
|
10501
|
-
}, guarded(() => {
|
|
10695
|
+
}, guarded(async () => {
|
|
10502
10696
|
const peers = live?.connected ? `\nPeople in the room: ${live.otherPeers.map((p) => p.name).join(", ") || "none"}` : "";
|
|
10503
|
-
|
|
10697
|
+
const warnings = await warningsSuffix(diagram);
|
|
10698
|
+
return `${describeDiagram(diagram)}${peers}${warnings}`;
|
|
10504
10699
|
}));
|
|
10505
10700
|
server.registerTool("diagram_add_nodes", {
|
|
10506
10701
|
title: "Add nodes",
|
|
@@ -10589,10 +10784,11 @@ server.registerTool("diagram_layout", {
|
|
|
10589
10784
|
direction: z.enum(["TB", "LR"]).optional().describe("Flow direction (default TB)"),
|
|
10590
10785
|
keys: z.array(z.string()).optional().describe("Only these nodes (default: all)")
|
|
10591
10786
|
}
|
|
10592
|
-
}, guarded(({ direction, keys }) => {
|
|
10787
|
+
}, guarded(async ({ direction, keys }) => {
|
|
10593
10788
|
const count = diagram.layout(direction ?? "TB", keys);
|
|
10594
10789
|
if (count === 0) return "Nothing to lay out.";
|
|
10595
|
-
|
|
10790
|
+
const warnings = await warningsSuffix(diagram);
|
|
10791
|
+
return `Arranged ${count} nodes (${direction ?? "TB"}).${warnings}`;
|
|
10596
10792
|
}));
|
|
10597
10793
|
server.registerTool("icons_search", {
|
|
10598
10794
|
title: "Search icons",
|
|
@@ -10623,7 +10819,7 @@ server.registerTool("icons_search", {
|
|
|
10623
10819
|
}));
|
|
10624
10820
|
server.registerTool("icons_import", {
|
|
10625
10821
|
title: "Load an icon pack",
|
|
10626
|
-
description: "Load an icon pack the user downloaded, so its icons can be used as nodes: the official AWS, Azure or Google Cloud icon ZIP, or a folder of SVG files. The icons stay available until the server stops; nodes embed their SVG, so the diagram renders anywhere. Example: path=\"/Users/me/Downloads/Icon-package.zip\".",
|
|
10822
|
+
description: "Load an icon pack the user downloaded, so its icons can be used as nodes: the official AWS, Azure or Google Cloud icon ZIP, or a folder of SVG files. The icons stay available until the server stops (after a restart, load the pack again; MARKASSO_ICON_PACKS loads it on every start); nodes embed their SVG, so the diagram renders anywhere. Example: path=\"/Users/me/Downloads/Icon-package.zip\".",
|
|
10627
10823
|
inputSchema: { path: z.string().min(1).max(1024).describe("Absolute path to the ZIP file or the extracted folder") },
|
|
10628
10824
|
annotations: {
|
|
10629
10825
|
readOnlyHint: true,
|
|
@@ -10633,7 +10829,7 @@ server.registerTool("icons_import", {
|
|
|
10633
10829
|
const pack = await userIconPacks.load(path);
|
|
10634
10830
|
const sample = pack.icons.slice(0, 3).map((i) => i.ref).join(", ");
|
|
10635
10831
|
const skipped = pack.skipped ? ` Skipped ${pack.skipped} files that were not plain, safe SVG icons.` : "";
|
|
10636
|
-
return `Loaded ${pack.icons.length} icons from ${pack.name} as "${pack.slug}/..." (e.g. ${sample}).${skipped} Find them with icons_search.`;
|
|
10832
|
+
return `Loaded ${pack.icons.length} icons from ${pack.name} as "${pack.slug}/..." (e.g. ${sample}).${skipped} Find them with icons_search. The pack lasts until the server stops: to have it on every start, add its path to MARKASSO_ICON_PACKS.`;
|
|
10637
10833
|
}));
|
|
10638
10834
|
server.registerTool("diagram_save", {
|
|
10639
10835
|
title: "Save .markasso",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markasso/mcp",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"mcpName": "io.github.AlbertoBarrago/markasso",
|
|
5
5
|
"description": "MCP server that lets AI agents create, read and edit Markasso diagrams, offline or live on a shared board",
|
|
6
6
|
"type": "module",
|