Skip to main content
Glama
yctimlin

Excalidraw MCP Server

by yctimlin

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

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'] } },
  • Zod schema (ElementIdsSchema) used for input validation/parsing in the lock_elements handler.
    const ElementIdsSchema = z.object({ elementIds: z.array(z.string()) });
  • 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}`); } }

Other Tools

Related Tools

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/yctimlin/mcp_excalidraw'

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