lock_elements
Prevent modification of specific elements in Excalidraw diagrams by locking them, ensuring controlled and secure diagram editing.
Instructions
Lock elements to prevent modification
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| elementIds | Yes |
Implementation Reference
- src/index.ts:389-402 (registration)Tool registration including name, description, and input schema definition for 'lock_elements' in the tools array.{ name: 'lock_elements', description: 'Lock elements to prevent modification', inputSchema: { type: 'object', properties: { elementIds: { type: 'array', items: { type: 'string' } } }, required: ['elementIds'] } },
- src/index.ts:204-206 (schema)Zod schema (ElementIdsSchema) used for input validation/parsing in the lock_elements handler.const ElementIdsSchema = z.object({ elementIds: z.array(z.string()) });
- src/index.ts:808-832 (handler)Main handler logic for 'lock_elements': parses args with ElementIdsSchema, updates each element's 'locked' property to true via updateElementOnCanvas (which syncs to canvas), counts successful updates, returns success result or throws error.case 'lock_elements': { const params = ElementIdsSchema.parse(args); const { elementIds } = params; try { // Lock elements through HTTP API updates const updatePromises = elementIds.map(async (id) => { return await updateElementOnCanvas({ id, locked: true }); }); const results = await Promise.all(updatePromises); const successCount = results.filter(result => result).length; if (successCount === 0) { throw new Error('Failed to lock any elements: HTTP server unavailable'); } const result = { locked: true, elementIds, successCount }; return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { throw new Error(`Failed to lock elements: ${(error as Error).message}`); } }