lock_elements
Prevent accidental edits by locking selected elements in Excalidraw diagrams to maintain layout integrity during collaborative work.
Instructions
Lock elements to prevent modification
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| elementIds | Yes |
Implementation Reference
- src/index.js:536-550 (handler)Handler for the 'lock_elements' tool: parses input elementIds, sets locked=true on each existing element, and returns confirmation.case 'lock_elements': { const params = ElementIdsSchema.parse(args); const { elementIds } = params; elementIds.forEach(id => { const element = elements.get(id); if (element) { element.locked = true; } }); const result = { locked: true, elementIds }; return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
- src/index.js:52-54 (schema)Zod schema defining the input for lock_elements (and similar tools): an object with elementIds array.const ElementIdsSchema = z.object({ elementIds: z.array(z.string()) });
- src/index.js:241-252 (registration)Registration of 'lock_elements' tool in MCP server capabilities, including input schema.lock_elements: { description: 'Lock elements to prevent modification', inputSchema: { type: 'object', properties: { elementIds: { type: 'array', items: { type: 'string' } } }, required: ['elementIds'] }
- src/index.js:814-825 (registration)Tool schema returned in ListToolsRequestHandler for 'lock_elements'.name: 'lock_elements', description: 'Lock elements to prevent modification', inputSchema: { type: 'object', properties: { elementIds: { type: 'array', items: { type: 'string' } } }, required: ['elementIds'] }
- src/index.js:30-46 (schema)General ElementSchema including 'locked' boolean field, used across tools.const ElementSchema = z.object({ type: z.enum(Object.values(EXCALIDRAW_ELEMENT_TYPES)), x: z.number(), y: z.number(), width: z.number().optional(), height: z.number().optional(), points: z.array(z.object({ x: z.number(), y: z.number() })).optional(), backgroundColor: z.string().optional(), strokeColor: z.string().optional(), strokeWidth: z.number().optional(), roughness: z.number().optional(), opacity: z.number().optional(), text: z.string().optional(), fontSize: z.number().optional(), fontFamily: z.number().optional(), locked: z.boolean().optional() // ADDED: Make sure locked status is saved });