Skip to main content
Glama

get_drawing

Retrieve an Excalidraw drawing by its unique ID to access, view, or edit existing diagrams within the Excalidraw MCP Server.

Instructions

Get an Excalidraw drawing by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Implements the core logic to retrieve a drawing by ID: validates ID, reads content and metadata from storage files, handles errors.
    export async function getDrawing(
      id: string
    ): Promise<{ id: string; name: string; content: string; metadata: any }> {
      // 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 {
        // Read the drawing content
        const content = await fs.readFile(filePath, "utf-8");
    
        // Read the metadata
        const metadataStr = await fs.readFile(metadataPath, "utf-8");
        const metadata = safeJsonParse(metadataStr, "drawing metadata");
    
        return {
          id,
          name: metadata.name,
          content,
          metadata,
        };
      } 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 for validating input to get_drawing tool (requires 'id' string).
    export const GetDrawingSchema = z.object({
      id: z.string().min(1),
    });
  • src/index.ts:70-74 (registration)
    Registers the 'get_drawing' tool in the MCP server with name, description, and input schema.
    {
      name: "get_drawing",
      description: "Get an Excalidraw drawing by ID",
      inputSchema: zodToJsonSchema(drawings.GetDrawingSchema),
    },
  • Dispatcher handler in main server that parses args, calls getDrawing, and formats response for MCP.
    case "get_drawing": {
      const args = drawings.GetDrawingSchema.parse(request.params.arguments);
      const result = await drawings.getDrawing(args.id);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.0
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

C2.8/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves a drawing by ID but does not describe what happens if the ID is invalid (e.g., error handling), whether it requires authentication, rate limits, or the format of the returned drawing. For a read operation with zero annotation coverage, this leaves significant gaps in understanding behavior.

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 that front-loads the core action ('Get an Excalidraw drawing by ID') with zero wasted words. It is appropriately sized for a simple retrieval tool and earns its place by clearly stating the purpose.

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 simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It lacks details on error cases, return format (e.g., drawing data structure), and how it differs from siblings like 'export_to_json'. For a tool in a set with multiple export options, more context is needed to guide effective use.

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. It mentions the 'id' parameter but provides no additional meaning beyond what the schema implies (a string of minLength 1). It does not explain what the ID represents (e.g., a unique identifier for drawings), where to obtain it, or format examples. The description adds minimal value over the bare schema.

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 ('Get') and resource ('an Excalidraw drawing'), specifying retrieval by ID. It distinguishes from siblings like 'list_drawings' (which retrieves multiple) and 'create_drawing' (which creates new), but could be more explicit about the distinction. The purpose is specific and actionable.

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 does not mention prerequisites (e.g., needing a valid drawing ID), exclusions (e.g., not for creating or updating), or direct comparisons to siblings like 'list_drawings' for bulk retrieval. Usage is implied but not explicitly stated.

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