Skip to main content
Glama
Abdullah007bajwa

Excalidraw MCP Server

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
    });

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries the full burden. It states the intended effect (prevent modification) but does not disclose side effects, reversibility, permissions, or persistence. This is significantly under-specified for a mutating operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, direct, and front-loaded. Every word earns its place with no waste or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that modifies state, the description lacks context on prerequisites, reversibility, and effects. Sibling tools like unlock_elements exist, but the description doesn't reference them, leaving the agent uncertain about the tool's broader usage context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has one parameter, elementIds, with 0% description coverage. The description says 'elements' but does not explain that the parameter is an array of element IDs or how to obtain them. The parameter name is self-explanatory, providing minimal additional value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Lock elements to prevent modification' with a specific verb (lock), resource (elements), and purpose (prevent modification). This distinguishes it from siblings like unlock_elements and other element operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when modification should be prevented, but provides no explicit when-to-use or alternatives (e.g., no mention of unlock_elements for reversal). It is clear enough for basic use but lacks decision guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.