delete_element
Remove specific elements from Excalidraw diagrams by ID to clean up or edit visual content.
Instructions
Delete an Excalidraw element
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/index.js:406-417 (handler)The switch case handler in the CallToolRequestSchema that executes the delete_element tool: parses the ID using Zod schema, verifies existence in the elements Map, deletes the element, and returns a JSON response indicating success.case 'delete_element': { const params = ElementIdSchema.parse(args); const { id } = params; if (!elements.has(id)) throw new Error(`Element with ID ${id} not found`); elements.delete(id); return { content: [{ type: 'text', text: JSON.stringify({ id, deleted: true }, null, 2) }] }; }
- src/index.js:145-154 (registration)Registration of the delete_element tool in the MCP server capabilities, including its description and input schema.delete_element: { description: 'Delete an Excalidraw element', inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] } },
- src/index.js:48-50 (schema)Zod schema (ElementIdSchema) used to validate and parse the input arguments (id) for the delete_element handler.const ElementIdSchema = z.object({ id: z.string() });