Skip to main content
Glama

export_to_png

Convert Excalidraw drawings to PNG format with customizable quality, scale, and display settings for easy sharing and integration.

Instructions

Export an Excalidraw drawing to PNG

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
exportBackgroundNo
exportWithDarkModeNo
idYes
qualityNo
scaleNo

Implementation Reference

  • The core handler function that executes the export_to_png tool. It validates the file ID, fetches the drawing, and returns a base64 PNG (placeholder).
    export async function exportToPng( id: string, quality: number = 0.92, scale: number = 1, exportWithDarkMode: boolean = false, exportBackground: boolean = true ): Promise<string> { // Validate the ID for security validateFileId(id); 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( sanitizeErrorMessage(error, "Failed to export drawing to PNG") ); } }
  • 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), });
  • src/index.ts:96-98 (registration)
    Tool registration in listTools handler, specifying name, description, and input schema.
    name: "export_to_png", description: "Export an Excalidraw drawing to PNG", inputSchema: zodToJsonSchema(exportOps.ExportToPngSchema),
  • src/index.ts:176-190 (registration)
    Dispatch handler in callToolRequest that parses args with schema 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/andreswebs-public-images/excalidraw-mcp'

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