Skip to main content
Glama
yctimlin

Excalidraw MCP Server

by yctimlin

delete_element

Remove a specific element from an Excalidraw diagram by its unique ID using the structured API of the Excalidraw MCP Server.

Instructions

Delete an Excalidraw element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Main handler logic for the 'delete_element' tool: validates input using ElementIdSchema, calls deleteElementOnCanvas helper, checks success, logs, and returns formatted response.
    case 'delete_element': {
      const params = ElementIdSchema.parse(args);
      const { id } = params;
    
      // Delete element directly on HTTP server (no local storage)
      const canvasResult = await deleteElementOnCanvas(id);
    
      if (!canvasResult || !(canvasResult as ApiResponse).success) {
        throw new Error('Failed to delete element: HTTP server unavailable or element not found');
      }
    
      const result = { id, deleted: true, syncedToCanvas: true };
      logger.info('Element deleted via MCP and synced to canvas', result);
    
      return {
        content: [{
          type: 'text',
          text: `Element deleted successfully!\n\n${JSON.stringify(result, null, 2)}\n\nāœ… Synced to canvas`
        }]
      };
    }
  • Tool definition including name, description, and inputSchema for 'delete_element' used in tool registration and capabilities.
    {
      name: 'delete_element',
      description: 'Delete an Excalidraw element',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'string' }
        },
        required: ['id']
      }
    },
  • Helper function that performs the actual deletion by syncing to the canvas HTTP API using syncToCanvas.
    async function deleteElementOnCanvas(elementId: string): Promise<any> {
      const result = await syncToCanvas('delete', { id: elementId });
      return result;
    }
  • Zod schema for validating the 'id' input parameter used in the delete_element handler.
    const ElementIdSchema = z.object({
      id: z.string()
    });
  • src/index.ts:490-504 (registration)
    Server initialization where all tools, including 'delete_element', are registered via the tools array and capabilities.
    const server = new Server(
      {
        name: "mcp-excalidraw-server",
        version: "1.0.2",
        description: "Advanced MCP server for Excalidraw with real-time canvas"
      },
      {
        capabilities: {
          tools: Object.fromEntries(tools.map(tool => [tool.name, {
            description: tool.description,
            inputSchema: tool.inputSchema
          }]))
        }
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. 'Delete' implies a destructive mutation, but it doesn't disclose if deletion is permanent, requires specific permissions, affects related elements, or what happens on success/failure. This leaves significant behavioral gaps for a destructive 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, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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 destructive tool with no annotations, 0% schema coverage, and no output schema, the description is inadequate. It lacks details on behavior, parameters, outcomes, and usage context, leaving the agent with insufficient information to invoke it safely and correctly.

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%, with one parameter 'id' undocumented in both schema and description. The description adds no meaning beyond the tool name, failing to explain what 'id' represents (e.g., element identifier, format, source) or how to obtain it, which is critical for a deletion tool.

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 action ('Delete') and resource ('an Excalidraw element'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'update_element' or 'create_element' in terms of when deletion is appropriate versus modification or creation.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'update_element' and 'create_element', there's no indication of whether deletion is irreversible, when it's preferred over updating, or any prerequisites for use.

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