forked from hustcc/mcp-mermaid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
46 lines (44 loc) · 1.77 KB
/
Copy pathindex.ts
File metadata and controls
46 lines (44 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { z } from "zod";
import { zodToJsonSchema } from "../utils";
export const schema = z.object({
mermaid: z
.string()
.describe(`The mermaid diagram syntax used to be generated, such as, graph TD;
A-->B;
A-->C;
B-->D;
C-->D;.`)
.nonempty({ message: "The mermaid string cannot be empty." }),
theme: z
.enum(["default", "base", "forest", "dark", "neutral"])
.describe("Theme for the diagram (optional). Default is 'default'.")
.optional()
.default("default"),
look: z
.enum(["classic", "handDrawn"])
.describe(
"Visual style for the diagram (optional). 'classic' is the default Mermaid look; 'handDrawn' produces a sketchy, Excalidraw-like rendering (Mermaid v11+).",
)
.optional()
.default("classic"),
backgroundColor: z
.string()
.describe(
"Background color for the diagram (optional). Default is 'white'.",
)
.optional()
.default("white"),
outputType: z
.enum(["base64", "svg", "mermaid", "file", "svg_url", "png_url"])
.describe(
"The output type of the diagram. Can be 'base64', 'svg', 'mermaid', 'file', 'svg_url', or 'png_url'. Default is 'base64'. 'base64' returns PNG image as base64 encoded string. 'file' saves the PNG image to disk. The *_url options return public mermaid.ink links for remote-friendly sharing.",
)
.optional()
.default("base64"),
});
export const tool = {
name: "generate_mermaid_diagram",
description:
"Generate mermaid diagram and chart with mermaid syntax dynamically. Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. The main purpose of Mermaid is to help documentation catch up with development.",
inputSchema: zodToJsonSchema(schema),
};