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}`);
      }
    }
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 with side effects, but lacks details on permissions required, whether locking is reversible (though 'unlock_elements' exists as a sibling), error conditions (e.g., invalid IDs), or system-wide impacts. This is inadequate for a mutation tool with zero annotation coverage.

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 extremely concise at 5 words, front-loading the core action ('Lock elements') and purpose ('to prevent modification') without any wasted text. Every word earns its place, making it easy to parse quickly.

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 tool's complexity as a mutation operation with no annotations, no output schema, and 1 undocumented parameter, the description is incomplete. It lacks essential context such as return values, error handling, permissions, or how locking interacts with other tools (e.g., if locked elements can still be queried). The presence of 'unlock_elements' as a sibling hints at reversibility but isn't explicitly stated.

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

Parameters1/5

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

The input schema has 1 parameter with 0% description coverage, and the tool description provides no information about parameters. It doesn't explain what 'elementIds' represents (e.g., format, source, or constraints), leaving the agent to guess based on the schema alone. With low schema coverage, the description fails to compensate.

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 a specific purpose ('to prevent modification'). It distinguishes from siblings like 'unlock_elements' by indicating the opposite action. However, it doesn't explicitly differentiate from other modification-related tools like 'update_element' or 'delete_element' beyond the general prevention concept.

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. It doesn't mention prerequisites (e.g., needing existing elements), exclusions (e.g., cannot lock already locked elements), or direct comparisons to siblings like 'unlock_elements' for reversing the action or 'update_element' for when modification is needed instead.

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

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