generate_diagram
Create Mermaid diagrams from text descriptions to visualize concepts and workflows for documentation.
Instructions
Generate a Mermaid diagram from a text description.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes |
Implementation Reference
- src/lib/handlers/smart.ts:193-204 (handler)The MCP tool handler for generate_diagram, which validates brain availability, generates the Mermaid diagram via the brain module, and returns the diagram code with rendering instructions.async generate_diagram(args: { description: string }) { if (!brain.isEnabled()) { return { error: ERROR_MESSAGES.SMART_FEATURES_DISABLED }; } const diagram = await brain.generateDiagram(args.description); return { diagram, note: 'Copy this Mermaid code into an Outline document to render the diagram.', }; },
- src/lib/schemas.ts:164-166 (schema)Zod schema for validating the input to the generate_diagram tool, requiring a non-empty string description.export const generateDiagramSchema = z.object({ description: z.string().min(1, 'Description is required'), });
- src/lib/tools.ts:225-229 (registration)Tool registration using createTool function, defining the name, description, and internal handler reference for generate_diagram.createTool( 'generate_diagram', 'Generate a Mermaid diagram from a text description.', 'generate_diagram' ),
- src/lib/brain/index.ts:178-181 (helper)Core logic in the Brain class that checks if features are enabled and delegates diagram generation to the processor's generateMermaid method.async generateDiagram(description: string): Promise<string> { this.checkEnabled(); return this.processor.generateMermaid(description); }