Skip to main content
Glama

get_drawing

Retrieve an existing Excalidraw drawing using its unique identifier to access, view, or continue working on saved diagrams and sketches.

Instructions

Get an Excalidraw drawing by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • The core handler function `getDrawing` that validates the ID, reads drawing content and metadata from storage files, and returns the drawing data or throws appropriate 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 input validation of the get_drawing tool, requiring a non-empty string 'id'.
    export const GetDrawingSchema = z.object({ id: z.string().min(1), });
  • src/index.ts:70-74 (registration)
    Registration of the 'get_drawing' tool in the MCP server's listTools response, including name, description, and input schema.
    { name: "get_drawing", description: "Get an Excalidraw drawing by ID", inputSchema: zodToJsonSchema(drawings.GetDrawingSchema), },
  • src/index.ts:126-132 (registration)
    Dispatch handler in the MCP server's CallToolRequest that parses arguments using the schema and calls the getDrawing function.
    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) }], }; }

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