delete_element
Remove a specific element from an Excalidraw diagram by providing its unique ID, enabling precise diagram editing and management.
Instructions
Delete an Excalidraw element
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/index.js:406-417 (handler)The handler function for the 'delete_element' tool. It validates the input using ElementIdSchema, checks if the element exists in the in-memory store, deletes it using elements.delete(id), and returns a confirmation message.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:48-50 (schema)Zod schema used for input validation in the delete_element handler, defining the required 'id' parameter.const ElementIdSchema = z.object({ id: z.string() });
- src/index.js:145-154 (registration)Tool registration in the MCP server capabilities, including description and input schema for delete_element.delete_element: { description: 'Delete an Excalidraw element', inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] } },
- src/index.js:711-719 (schema)Duplicate schema definition for delete_element in the ListToolsRequestHandler response.name: 'delete_element', description: 'Delete an Excalidraw element', inputSchema: { type: 'object', properties: { id: { type: 'string' } }, required: ['id'] }