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 }],
      };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool exports a drawing but does not cover critical aspects such as whether it requires specific permissions, if it modifies the original drawing, rate limits, or what the output looks like (e.g., file format details). This is a significant gap for a tool with mutation-like behavior.

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 with zero waste. It is front-loaded and appropriately sized for the tool's purpose, making it easy to understand at a glance without unnecessary elaboration.

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 complexity (5 parameters, no output schema, no annotations), the description is incomplete. It does not address behavioral traits, parameter meanings, or output details, leaving gaps that could hinder an AI agent's ability to use the tool correctly. For an export tool with multiple configurable options, more context is needed.

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 description adds no parameter semantics beyond the input schema, which has 0% description coverage. It does not explain what 'id', 'quality', 'scale', etc., mean or how they affect the export. However, with 5 parameters including defaults and ranges in the schema, the baseline is 3 as the schema provides some structure, but the description fails to compensate for the lack of semantic details.

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 action ('Export') and the resource ('an Excalidraw drawing'), specifying the output format ('to PNG'). It distinguishes from sibling tools like 'export_to_json' and 'export_to_svg' by naming the format, but does not clarify if it's for a single drawing or batch, which could improve specificity.

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?

No guidance is provided on when to use this tool versus alternatives like 'export_to_svg' or 'export_to_json'. It does not mention prerequisites (e.g., needing an existing drawing) or exclusions, leaving usage context implied but not explicit.

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

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