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 }],
      };
    }
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 doesn't describe whether this is a read-only operation, what permissions are required, if it modifies the drawing, the output structure, or any rate limits. This leaves significant gaps for a tool that likely interacts with data.

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 appropriately sized and front-loaded, making it easy to parse quickly.

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 lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't address behavioral aspects like safety or output format, nor does it clarify parameter semantics, making it inadequate for a tool that exports data, especially with siblings offering similar functionality.

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 schema has 0% description coverage, with one required parameter 'id' undocumented in both schema and description. The description adds no meaning about what 'id' represents (e.g., a drawing identifier), its format, or how to obtain it, failing to compensate for the low schema coverage.

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 verb ('Export') and resource ('an Excalidraw drawing') with the output format ('to JSON'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like export_to_png or export_to_svg, which perform similar export operations but to different formats.

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 such as export_to_png or export_to_svg, nor does it mention prerequisites like needing an existing drawing ID. It only states what the tool does, leaving usage context implied from the tool name and sibling list.

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