Skip to main content
Glama

update_drawing

Modify existing Excalidraw diagrams by providing new content to replace the current version, enabling diagram editing and updates.

Instructions

Update an Excalidraw drawing by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
contentYes

Implementation Reference

  • The main handler function that performs the update logic: validates ID, reads metadata, updates drawing content and metadata timestamp, returns id and name.
    export async function updateDrawing(
      id: string,
      content: string
    ): Promise<{ id: string; name: string }> {
      // Validate the ID for security
      validateFileId(id);
    
      await ensureStorageDir();
    
      // Get the drawing file path
      const filePath = path.join(STORAGE_DIR, `${id}.json`);
      const metadataPath = path.join(STORAGE_DIR, `${id}.meta.json`);
    
      try {
        // Check if the drawing exists
        await fs.access(filePath);
    
        // Read the metadata
        const metadataStr = await fs.readFile(metadataPath, "utf-8");
        const metadata = safeJsonParse(metadataStr, "drawing metadata");
    
        // Update the drawing content
        await fs.writeFile(filePath, content, "utf-8");
    
        // Update the metadata
        metadata.updatedAt = new Date().toISOString();
        await fs.writeFile(
          metadataPath,
          JSON.stringify(metadata, null, 2),
          "utf-8"
        );
    
        return { id, name: metadata.name };
      } catch (error) {
        if (error instanceof ExcalidrawValidationError) {
          throw error; // Re-throw validation errors as-is
        }
        throw new ExcalidrawResourceNotFoundError(
          sanitizeErrorMessage(error, `Drawing with ID ${id} not found`)
        );
      }
  • Zod schema defining the input parameters for the update_drawing tool: id and content.
    export const UpdateDrawingSchema = z.object({
      id: z.string().min(1),
      content: z.string().min(1),
    });
  • src/index.ts:75-79 (registration)
    Registers the update_drawing tool in the MCP server's listTools response, including name, description, and input schema.
    {
      name: "update_drawing",
      description: "Update an Excalidraw drawing by ID",
      inputSchema: zodToJsonSchema(drawings.UpdateDrawingSchema),
    },
  • Dispatch handler in the main CallToolRequestSchema that parses arguments and calls the updateDrawing function.
    case "update_drawing": {
      const args = drawings.UpdateDrawingSchema.parse(
        request.params.arguments
      );
      const result = await drawings.updateDrawing(args.id, args.content);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It states the tool updates a drawing but doesn't mention permissions needed, whether changes are reversible, rate limits, or response format. 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 no wasted words. It's front-loaded with the core action and resource, 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?

For a mutation tool with 2 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It lacks details on behavior, parameters, and output, leaving the agent with insufficient context to use it 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 schema only provides basic types and constraints. The description adds minimal semantics by implying 'id' identifies the drawing and 'content' holds the update data, but it doesn't explain format, structure, or examples, failing to compensate for the coverage gap.

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 ('Update') and resource ('an Excalidraw drawing by ID'), making the purpose evident. However, it doesn't differentiate from sibling tools like 'create_drawing' or 'get_drawing' beyond the verb, which slightly limits specificity.

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 such as 'create_drawing' or 'delete_drawing'. The description implies usage for modifying existing drawings but lacks explicit context, prerequisites, or exclusions.

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/andreswebs-public-images/excalidraw-mcp'

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