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

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