@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.
@@ -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
- const updates = { id: decoded.nodeId };
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
- updates.label = decoded.label;
261
+ node.label = decoded.label;
258
262
  changes.push('label');
259
263
  }
260
264
  if (decoded.description !== undefined) {
261
- updates.description = decoded.description;
265
+ node.description = decoded.description;
262
266
  changes.push('description');
263
267
  }
264
268
  if (decoded.nodeType !== undefined) {
265
- updates.nodeType = decoded.nodeType;
269
+ node.nodeType = decoded.nodeType;
266
270
  changes.push('nodeType');
267
271
  }
268
272
  if (decoded.domain !== undefined) {
269
- updates.domain = decoded.domain;
273
+ node.domain = decoded.domain;
270
274
  changes.push('domain');
271
275
  }
272
276
  if (decoded.input !== undefined) {
273
- updates.input = decoded.input;
277
+ node.input = decoded.input;
274
278
  changes.push('input');
275
279
  }
276
280
  if (decoded.output !== undefined) {
277
- updates.output = decoded.output;
281
+ node.output = decoded.output;
278
282
  changes.push('output');
279
283
  }
280
284
  if (changes.length === 0)
281
285
  return wrap('ℹ️ 无变更 — 请提供要更新的字段');
282
- updates.lastUpdated = new Date().toISOString();
283
- // 原子调用: PUT /flowcharts/:chartId/nodes/:nodeId
284
- await client().updateFlowchartNode(chartId, decoded.nodeId, updates, `MCP更新: ${changes.join(', ')}`);
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ppdocs/mcp",
3
- "version": "3.2.23",
3
+ "version": "3.2.24",
4
4
  "description": "ppdocs MCP Server - Knowledge Graph for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",