delete_drawing
Remove an Excalidraw drawing by specifying its ID to manage and organize your diagram collection.
Instructions
Delete an Excalidraw drawing by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/operations/drawings.ts:174-198 (handler)Core handler function that implements the deletion logic for a drawing by ID. Validates the ID, checks existence, deletes the content (.json) and metadata (.meta.json) files from storage, and handles errors appropriately.export async function deleteDrawing(id: string): Promise<void> { // Validate the ID for security validateFileId(id); await ensureStorageDir(); // Get the drawing file path const filePath = path.join(STORAGE_DIR, `${id}.json`); const metadataPath = path.join(STORAGE_DIR, `${id}.meta.json`); try { // Check if the drawing exists await fs.access(filePath); // Delete the drawing file await fs.unlink(filePath); // Delete the metadata file await fs.unlink(metadataPath); } catch (error) { throw new ExcalidrawResourceNotFoundError( sanitizeErrorMessage(error, `Drawing with ID ${id} not found`) ); } }
- src/operations/drawings.ts:52-54 (schema)Zod input schema for the delete_drawing tool, validating that 'id' is a non-empty string.export const DeleteDrawingSchema = z.object({ id: z.string().min(1), });
- src/index.ts:80-84 (registration)Tool registration in the listTools handler, defining the name, description, and input schema for delete_drawing.{ name: "delete_drawing", description: "Delete an Excalidraw drawing by ID", inputSchema: zodToJsonSchema(drawings.DeleteDrawingSchema), },
- src/index.ts:144-154 (handler)MCP callTool dispatcher for delete_drawing: parses arguments using the schema, calls the core deleteDrawing handler, and returns success response.case "delete_drawing": { const args = drawings.DeleteDrawingSchema.parse( request.params.arguments ); await drawings.deleteDrawing(args.id); return { content: [ { type: "text", text: JSON.stringify({ success: true }, null, 2) }, ], }; }