Skip to main content
Glama

export_to_json

Export Excalidraw drawings to JSON format for data storage, sharing, or integration with other applications.

Instructions

Export an Excalidraw drawing to JSON

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Core handler function that exports a drawing to JSON by retrieving the drawing content via getDrawing(id) and returning it as a string.
    export async function exportToJson(id: string): Promise<string> {
      try {
        // Get the drawing
        const drawing = await getDrawing(id);
        
        // Return the JSON content
        return drawing.content;
      } catch (error) {
        if (error instanceof ExcalidrawResourceNotFoundError) {
          throw error;
        }
        throw new Error(`Failed to export drawing to JSON: ${(error as Error).message}`);
      }
    }
  • Zod input schema for the export_to_json tool, requiring a string 'id'.
    export const ExportToJsonSchema = z.object({
      id: z.string().min(1),
    });
  • index.ts:97-101 (registration)
    Registers the export_to_json tool in the listTools response with name, description, and schema reference.
    {
      name: "export_to_json",
      description: "Export an Excalidraw drawing to JSON",
      inputSchema: zodToJsonSchema(exportOps.ExportToJsonSchema),
    },
  • MCP server handler for calling the export_to_json tool: parses arguments, invokes exportToJson, and formats response.
    case "export_to_json": {
      const args = exportOps.ExportToJsonSchema.parse(request.params.arguments);
      const result = await exportOps.exportToJson(args.id);
      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 the full burden of behavioral disclosure. It states the action ('Export') but does not describe what this entails—e.g., whether it's a read-only operation, if it requires specific permissions, what the output looks like, or any side effects. The description is minimal and lacks context beyond the basic action.

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 that directly states the tool's purpose without unnecessary words. It is front-loaded and appropriately sized for a simple tool, with zero waste or redundancy.

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 simplicity (1 parameter, no annotations, no output schema), the description is incomplete. It lacks details on parameter meaning, behavioral traits (e.g., read-only vs. destructive), and output format, which are essential for an agent to use it correctly. The description does not compensate for the absence of structured data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter (id) with 0% description coverage, and the tool description does not mention parameters at all. It adds no meaning beyond what the schema provides (e.g., explaining what 'id' refers to, such as a drawing identifier). With low schema coverage, the description fails to compensate, leaving parameters undocumented.

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 target resource ('an Excalidraw drawing to JSON'), making the purpose understandable. It distinguishes from siblings like export_to_png and export_to_svg by specifying the output format as JSON, but does not explicitly differentiate from other export or drawing-related tools beyond format.

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 does not mention prerequisites (e.g., needing an existing drawing ID), exclusions, or comparisons to siblings like get_drawing (which might retrieve drawing data) or other export tools. Usage is implied only by the tool name and description.

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