Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(ai): default generated flowchart theme

tianma-ife008b59f98e8
diff --git a/apps/api/src/mcp-management-tools.test.mjs b/apps/api/src/mcp-management-tools.test.mjs
index 7ed544d1..201c8276 100644
--- a/apps/api/src/mcp-management-tools.test.mjs
+++ b/apps/api/src/mcp-management-tools.test.mjs
@@ -105,7 +105,7 @@ describe("MCP template and AI instruction management", () => {
expect(created.diagram.nodes[0].layout).toBeUndefined();
const stored = sqlite.query("SELECT content_markdown FROM memo_contents WHERE memo_id = ?").get(created.memo.id);
const diagram = parseDiagramDocument(stored.content_markdown);
- expect(diagram).toMatchObject({ kind, theme: kind === "mind-map" ? "plain" : "brand" });
+ expect(diagram).toMatchObject({ kind, theme: kind === "architecture" ? "brand" : "plain" });
expect(diagram.nodes.map((node) => node.id)).toEqual(nodes.map((node) => node.id));
expect(diagram.nodes.every((node) => Number.isFinite(node.x) && Number.isFinite(node.y))).toBeTrue();
expect(diagram.nodes.every((node) => node.width > 0 && node.height > 0)).toBeTrue();
diff --git a/apps/api/src/mcp-tool-service.ts b/apps/api/src/mcp-tool-service.ts
index d098e639..79265468 100644
--- a/apps/api/src/mcp-tool-service.ts
+++ b/apps/api/src/mcp-tool-service.ts
@@ -485,9 +485,11 @@ export const callMcpTool = async (
const notebookId = getRequiredString(args.notebookId, "notebookId");
const ir = parseDiagramMemoIr(args);
const { compileDiagramIr } = await import("@edgeever/shared/diagram-layout");
- // Generated mind maps must start with the same theme as a note created
- // in the editor, even when an agent supplies an arbitrary color scheme.
- const document = compileDiagramIr(ir.kind === "mind-map" ? { ...ir, theme: DIAGRAM_DEFAULT_THEME } : ir);
+ // Generated mind maps and flowcharts start with the editor's default
+ // theme even when an agent supplies an arbitrary color scheme.
+ const document = compileDiagramIr(ir.kind === "mind-map" || ir.kind === "flowchart"
+ ? { ...ir, theme: DIAGRAM_DEFAULT_THEME }
+ : ir);
const contentMarkdown = serializeDiagramDocument(document);
if (!parseDiagramDocument(contentMarkdown)) {
throw new AppError("invalid_params", "The diagram graph could not be compiled", 400);
diff --git a/apps/api/src/mcp-tools.ts b/apps/api/src/mcp-tools.ts
index 4321e2db..1df147f2 100644
--- a/apps/api/src/mcp-tools.ts
+++ b/apps/api/src/mcp-tools.ts
@@ -330,7 +330,7 @@ const MCP_TOOL_DEFINITIONS = [
{
name: "create_diagram_memo",
description:
- "Create an editable visual diagram memo from a semantic graph; EdgeEver generates node sizes, coordinates, edge IDs, and a deterministic layout. Mind maps always start with the default plain theme; any supplied theme is ignored for mind maps. For mind maps, omit node type and use parentId for hierarchy. Flowchart node types are process, decision, start, or end. Architecture node types are client, frontend, service, database, storage, queue, security, external, or boundary; boundary nodes may contain nodes through parentId but cannot be edge endpoints.",
+ "Create an editable visual diagram memo from a semantic graph; EdgeEver generates node sizes, coordinates, edge IDs, and a deterministic layout. Mind maps and flowcharts always start with the default plain theme; any supplied theme is ignored for those kinds. For mind maps, omit node type and use parentId for hierarchy. Flowchart node types are process, decision, start, or end. Architecture node types are client, frontend, service, database, storage, queue, security, external, or boundary; boundary nodes may contain nodes through parentId but cannot be edge endpoints.",
inputSchema: {
type: "object",
required: ["notebookId", "kind", "nodes"],
@@ -339,7 +339,7 @@ const MCP_TOOL_DEFINITIONS = [
notebookId: { type: "string", minLength: 1 },
title: { type: "string", maxLength: 160 },
kind: { type: "string", enum: ["mind-map", "flowchart", "architecture"] },
- theme: { type: "string", description: "Color scheme for non-mind-map diagrams. Mind maps always start with the default plain theme.", enum: ["plain", "brand", "sun", "wa", "island", "rose", "mint", "cosmos", "tea", "naive", "macaron", "ocean", "ink", "classic", "paper"] },
+ theme: { type: "string", description: "Color scheme for architecture diagrams. Mind maps and flowcharts always start with the default plain theme.", enum: ["plain", "brand", "sun", "wa", "island", "rose", "mint", "cosmos", "tea", "naive", "macaron", "ocean", "ink", "classic", "paper"] },
structure: { type: "string", enum: ["map", "line", "capsule", "box", "circle", "ellipse", "hexagon", "logic", "tree", "brace", "org", "timeline", "fishbone"] },
layout: {
type: "object",