Skip to main content
Glama

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
NameRequiredDescriptionDefault
descriptionYes

Implementation Reference

  • The MCP tool handler for 'generate_diagram'. Validates brain is enabled, calls brain.generateDiagram, and returns the Mermaid diagram code with a usage note.
    /** * Generate a Mermaid diagram from description */ 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.', }; },
  • Core implementation in Brain class that checks if enabled and delegates to LlmProcessor.generateMermaid to produce the diagram.
    async generateDiagram(description: string): Promise<string> { this.checkEnabled(); return this.processor.generateMermaid(description); }
  • Zod schema defining the input for generate_diagram tool: requires a 'description' string.
    export const generateDiagramSchema = z.object({ description: z.string().min(1, 'Description is required'), });
  • Registration of the 'generate_diagram' tool in the allTools array, using the schema and providing description.
    createTool( 'generate_diagram', 'Generate a Mermaid diagram from a text description.', 'generate_diagram' ),
  • Inclusion of generateDiagramSchema in the central toolSchemas map under key 'generate_diagram'.
    generate_diagram: generateDiagramSchema,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/huiseo/outline-smart-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server