@ppdocs/mcp 3.2.23 → 3.2.24
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/tools/flowchart.js +15 -12
- package/package.json +1 -1
package/dist/tools/flowchart.js
CHANGED
|
@@ -250,39 +250,42 @@ export function registerFlowchartTools(server, ctx) {
|
|
|
250
250
|
const chartId = decoded.chartId || 'main';
|
|
251
251
|
if (!decoded.nodeId)
|
|
252
252
|
return wrap('❌ update_node 需要 nodeId');
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
const chart = await client().getFlowchart(chartId);
|
|
254
|
+
if (!chart)
|
|
255
|
+
return wrap(`❌ 流程图 "${chartId}" 不存在`);
|
|
256
|
+
const node = (chart.nodes || []).find((n) => n.id === decoded.nodeId);
|
|
257
|
+
if (!node)
|
|
258
|
+
return wrap(`❌ 节点 "${decoded.nodeId}" 不存在`);
|
|
255
259
|
const changes = [];
|
|
256
260
|
if (decoded.label !== undefined) {
|
|
257
|
-
|
|
261
|
+
node.label = decoded.label;
|
|
258
262
|
changes.push('label');
|
|
259
263
|
}
|
|
260
264
|
if (decoded.description !== undefined) {
|
|
261
|
-
|
|
265
|
+
node.description = decoded.description;
|
|
262
266
|
changes.push('description');
|
|
263
267
|
}
|
|
264
268
|
if (decoded.nodeType !== undefined) {
|
|
265
|
-
|
|
269
|
+
node.nodeType = decoded.nodeType;
|
|
266
270
|
changes.push('nodeType');
|
|
267
271
|
}
|
|
268
272
|
if (decoded.domain !== undefined) {
|
|
269
|
-
|
|
273
|
+
node.domain = decoded.domain;
|
|
270
274
|
changes.push('domain');
|
|
271
275
|
}
|
|
272
276
|
if (decoded.input !== undefined) {
|
|
273
|
-
|
|
277
|
+
node.input = decoded.input;
|
|
274
278
|
changes.push('input');
|
|
275
279
|
}
|
|
276
280
|
if (decoded.output !== undefined) {
|
|
277
|
-
|
|
281
|
+
node.output = decoded.output;
|
|
278
282
|
changes.push('output');
|
|
279
283
|
}
|
|
280
284
|
if (changes.length === 0)
|
|
281
285
|
return wrap('ℹ️ 无变更 — 请提供要更新的字段');
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
return wrap(`✅ 节点已更新: ${decoded.label || decoded.nodeId} [${chartId}/${decoded.nodeId}]\n更新字段: ${changes.join(', ')}`);
|
|
286
|
+
node.lastUpdated = new Date().toISOString();
|
|
287
|
+
await client().saveFlowchart(chartId, chart);
|
|
288
|
+
return wrap(`✅ 节点已更新: ${node.label} [${chartId}/${decoded.nodeId}]\n更新字段: ${changes.join(', ')}`);
|
|
286
289
|
}
|
|
287
290
|
case 'delete_node': {
|
|
288
291
|
const chartId = decoded.chartId || 'main';
|