Skip to main content
Glama

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
NameRequiredDescriptionDefault
elementIdsYes

Implementation Reference

  • 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) }] };
  • 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'] }
  • 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 });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Abdullah007bajwa/mcp_excalidraw'

If you have feedback or need assistance with the MCP directory API, please join our Discord server