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
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool prevents modification, implying a mutation that changes element state, but doesn't describe permissions needed, whether locking is reversible, effects on other operations, or error conditions. This leaves significant gaps for a mutation tool.

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, efficient sentence with zero waste. It's front-loaded with the core action and purpose, making it easy to parse quickly. Every word earns its place without 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?

Given the complexity of a mutation tool with no annotations, 0% schema coverage, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like side effects, return values, or error handling, leaving the agent with insufficient context to use the tool effectively.

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?

Schema description coverage is 0%, so the description must compensate for the undocumented parameter 'elementIds'. It implies the parameter is for specifying elements to lock, but doesn't explain what element IDs are, their format, or constraints like maximum array size. This adds minimal value beyond the schema's structure.

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

Purpose4/5

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

The description clearly states the verb ('lock') and resource ('elements') with the purpose to 'prevent modification'. It distinguishes from siblings like 'unlock_elements' and 'update_element' by specifying a protective action. However, it doesn't specify what type of elements or what modification means in this context, keeping it from a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'unlock_elements' for reversing the action, or 'update_element' for modifications. It lacks context about prerequisites, such as whether elements must be unlocked first, or exclusions for certain element types.

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

Install Server

Other 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/Abdullah007bajwa/mcp_excalidraw'

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