Skip to main content
Glama

export_to_json

Export an Excalidraw drawing to JSON format for data transfer, storage, or integration with other applications.

Instructions

Export an Excalidraw drawing to JSON

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • The handler function that exports a drawing by ID to JSON format by retrieving the drawing content after validation.
    export async function exportToJson(id: string): Promise<string> {
      // Validate the ID for security
      validateFileId(id);
    
      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(
          sanitizeErrorMessage(error, "Failed to export drawing to JSON")
        );
      }
    }
  • Zod schema defining the input for the export_to_json tool: requires a string 'id'.
    export const ExportToJsonSchema = z.object({
      id: z.string().min(1),
    });
  • src/index.ts:100-104 (registration)
    Registration of the export_to_json tool in the server's listTools response, including name, description, and schema.
    {
      name: "export_to_json",
      description: "Export an Excalidraw drawing to JSON",
      inputSchema: zodToJsonSchema(exportOps.ExportToJsonSchema),
    },
  • src/index.ts:192-200 (registration)
    Dispatch case in the callTool handler that parses arguments using the schema and invokes the exportToJson handler.
    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 }],
      };
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.0
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

C2.8/5.0
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.