Skip to main content
Glama

export_to_png

Convert Excalidraw drawings to PNG format with customizable quality, scale, and display options for sharing or embedding.

Instructions

Export an Excalidraw drawing to PNG

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
qualityNo
scaleNo
exportWithDarkModeNo
exportBackgroundNo

Implementation Reference

  • Core handler function that executes the export_to_png tool logic: fetches the drawing by ID and returns a base64-encoded PNG image (placeholder implementation).
    export async function exportToPng( id: string, quality: number = 0.92, scale: number = 1, exportWithDarkMode: boolean = false, exportBackground: boolean = true ): Promise<string> { try { // Get the drawing const drawing = await getDrawing(id); // Return the PNG content as a base64 string // Note: In a real implementation, we would use the Excalidraw API to convert the drawing to PNG // For now, we'll just return a placeholder return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=='; } catch (error) { if (error instanceof ExcalidrawResourceNotFoundError) { throw error; } throw new Error(`Failed to export drawing to PNG: ${(error as Error).message}`); } }
  • Zod schema defining the input parameters for the export_to_png tool.
    export const ExportToPngSchema = z.object({ id: z.string().min(1), quality: z.number().min(0).max(1).optional().default(0.92), scale: z.number().min(0.1).max(5).optional().default(1), exportWithDarkMode: z.boolean().optional().default(false), exportBackground: z.boolean().optional().default(true), });
  • index.ts:93-95 (registration)
    Registration of the export_to_png tool in the ListTools response, including name, description, and input schema.
    name: "export_to_png", description: "Export an Excalidraw drawing to PNG", inputSchema: zodToJsonSchema(exportOps.ExportToPngSchema),
  • Server-side handler in the CallToolRequest switch that parses arguments and invokes the exportToPng function.
    case "export_to_png": { const args = exportOps.ExportToPngSchema.parse(request.params.arguments); const result = await exportOps.exportToPng( args.id, args.quality, args.scale, args.exportWithDarkMode, args.exportBackground ); return { content: [{ type: "text", text: result }], };

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/i-tozer/excalidraw-mcp'

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