Skip to main content
Glama
huiseo
by huiseo

generate_diagram

Create Mermaid diagrams from text descriptions to visualize concepts and workflows for documentation in Outline Wiki.

Instructions

Generate a Mermaid diagram from a text description.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYes

Implementation Reference

  • MCP tool handler for generate_diagram. Checks if brain is enabled, calls brain.generateDiagram, and returns the Mermaid 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.',
      };
    },
  • 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'),
    });
  • Tool registration in the allTools array, converting the Zod schema to JSON schema for MCP.
    createTool(
      'generate_diagram',
      'Generate a Mermaid diagram from a text description.',
      'generate_diagram'
    ),
  • Brain class method that checks if enabled and delegates diagram generation to LlmProcessor.
    async generateDiagram(description: string): Promise<string> {
      this.checkEnabled();
      return this.processor.generateMermaid(description);
    }
  • Core implementation in LlmProcessor using OpenAI chat completion with a specific prompt to generate Mermaid code from description.
      async generateMermaid(description: string): Promise<string> {
        const prompt = `Convert the following process or flow description into a Mermaid.js diagram.
    Output ONLY the Mermaid code block, no explanation.
    Use appropriate diagram type (flowchart, sequence, etc.) based on the content.`;
    
        return this.complete(prompt, description);
      }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool generates a diagram but doesn't mention any behavioral traits such as output format (e.g., image, text), error handling, rate limits, authentication needs, or side effects. This leaves significant gaps for an agent to understand how to invoke it effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Generate a Mermaid diagram from a text description.' It is front-loaded with the core action and resource, with no wasted words or redundant information. This makes it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a generative operation with one parameter), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain what the output is (e.g., a diagram code, an image URL), how errors are handled, or any dependencies, leaving the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter ('description') with 0% schema description coverage, meaning the schema provides no semantic details. The description adds minimal value by implying the parameter is a 'text description' for generating the diagram, but it doesn't elaborate on format, length, or content expectations. This partially compensates for the low coverage but remains vague.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Generate a Mermaid diagram from a text description.' It specifies the verb ('Generate') and resource ('Mermaid diagram'), and the transformation from input to output is explicit. However, it doesn't distinguish this tool from potential siblings that might also generate diagrams in different formats or contexts, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. Given the sibling tools list includes various document and collection operations, there's no indication of whether this is for documentation, visualization, or other contexts, nor any prerequisites or exclusions mentioned. Usage is implied only by the tool's name and purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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-wiki-mcp'

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