export_to_json
Convert an Excalidraw drawing into JSON format using the provided drawing ID, enabling easy data integration and sharing.
Instructions
Export an Excalidraw drawing to JSON
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/operations/export.ts:70-83 (handler)Core handler function that fetches the drawing by ID and returns its JSON content.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}`); } }
- src/operations/export.ts:20-22 (schema)Zod schema defining the input for the export_to_json tool (requires 'id' string).export const ExportToJsonSchema = z.object({ id: z.string().min(1), });
- index.ts:97-101 (registration)Registration of the export_to_json tool in the ListTools response, including name, description, and schema reference.{ name: "export_to_json", description: "Export an Excalidraw drawing to JSON", inputSchema: zodToJsonSchema(exportOps.ExportToJsonSchema), },