delete_drawing
Remove an Excalidraw drawing by specifying its unique ID to manage your diagram collection and maintain workspace organization.
Instructions
Delete an Excalidraw drawing by ID
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>"
},
"name": "delete_drawing"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/operations/drawings.ts:131-150 (handler)Core implementation of deleteDrawing: removes the drawing content and metadata files from the storage directory.
export async function deleteDrawing(id: string): Promise<void> { 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(`Drawing with ID ${id} not found`); } } - index.ts:137-142 (handler)MCP tool call handler: parses input with schema and invokes the deleteDrawing function, 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) }], }; - index.ts:78-81 (registration)Registration of the delete_drawing tool in the ListTools response, specifying name, description, and input schema.
name: "delete_drawing", description: "Delete an Excalidraw drawing by ID", inputSchema: zodToJsonSchema(drawings.DeleteDrawingSchema), }, - src/operations/drawings.ts:37-39 (schema)Zod input schema validation for delete_drawing tool: requires a non-empty string 'id'.
export const DeleteDrawingSchema = z.object({ id: z.string().min(1), });