Skip to main content
Glama

export_to_png

Convert Excalidraw drawings to PNG format for sharing, embedding, or printing. Specify quality, scale, and display preferences to customize the output.

Instructions

Export an Excalidraw drawing to PNG

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
qualityNo
scaleNo
exportWithDarkModeNo
exportBackgroundNo

Implementation Reference

  • Core implementation of the export_to_png tool. Validates the drawing ID, fetches the drawing data, and returns a base64-encoded PNG image (placeholder for real Excalidraw API export).
    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 input schema for the export_to_png tool, defining parameters like id (required), quality, scale, dark mode, and background options.
    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:95-99 (registration)
    Registration of the export_to_png tool in the listTools handler, providing name, description, and JSON schema derived from ExportToPngSchema.
    {
      name: "export_to_png",
      description: "Export an Excalidraw drawing to PNG",
      inputSchema: zodToJsonSchema(exportOps.ExportToPngSchema),
    },
  • src/index.ts:176-190 (registration)
    Dispatch logic for export_to_png in the CallToolRequest handler: parses arguments using the 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 }],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It states the tool exports a drawing but doesn't mention what happens during export (e.g., file generation, download initiation, or return format), whether it requires specific permissions, or any rate limits. For a tool with 5 parameters and no annotations, this leaves significant behavioral gaps.

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 no wasted words. It's front-loaded with the core action and resource, making it immediately understandable. Every word earns its place by specifying the export target and format.

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 (5 parameters, no annotations, no output schema), the description is inadequate. It doesn't explain the export process, return values, or error conditions. For a tool that likely generates files or returns binary data, more context is needed to guide proper usage and expectations.

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?

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain what 'id' refers to, what 'quality' and 'scale' affect, or the purpose of 'exportWithDarkMode' and 'exportBackground'. The baseline is 3 since the schema fully defines parameters with types, ranges, and defaults, but the description provides zero semantic context.

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 resource ('an Excalidraw drawing') with the specific output format ('to PNG'). It distinguishes from siblings like export_to_json and export_to_svg by specifying PNG format, but doesn't differentiate from other export tools beyond format. The purpose is specific and unambiguous.

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. It doesn't mention when PNG export is preferable over SVG or JSON exports, nor does it reference prerequisites like needing an existing drawing ID. The agent must infer usage from the tool name alone.

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/andreswebs-public-images/excalidraw-mcp'

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