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

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