Skip to main content
Glama
renderer.ts950 B
import { RenderResult } from "./types.js"; import { validateMermaidSyntax } from "./validator.js"; export async function renderMermaid( diagram: string, background?: string, ): Promise<RenderResult> { try { // Validate the diagram first const validation = await validateMermaidSyntax(diagram); if (!validation.valid) { return { type: "error", diagram, error: validation.errors?.[0] || "Invalid diagram syntax", details: validation.errors?.join("\n"), }; } // Return the validated diagram for client-side rendering // The actual SVG rendering happens in the browser return { type: "success", diagram, background, // Note: svg field is populated by the client after rendering }; } catch (error) { return { type: "error", diagram, error: error instanceof Error ? error.message : "Failed to process diagram", }; } }

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/abrinsmead/mindpilot-mcp'

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