Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYes

Implementation Reference

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

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