Skip to main content
Glama

get_drawing

Retrieve an Excalidraw drawing by its unique ID for viewing, editing, or exporting to formats like SVG, PNG, or JSON.

Instructions

Get an Excalidraw drawing by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Handler logic for the 'get_drawing' tool in the switch statement of CallToolRequestSchema. Parses arguments using GetDrawingSchema and calls drawings.getDrawing to fetch the drawing.
    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) }], }; }
  • index.ts:68-71 (registration)
    Tool registration in the ListTools response, defining name, description, and input schema for 'get_drawing'.
    name: "get_drawing", description: "Get an Excalidraw drawing by ID", inputSchema: zodToJsonSchema(drawings.GetDrawingSchema), },
  • Zod schema for input validation of the 'get_drawing' tool, requiring an 'id' string.
    export const GetDrawingSchema = z.object({ id: z.string().min(1), });
  • Core helper function that implements the logic to retrieve a drawing by ID from storage files, reading content and metadata.
    export async function getDrawing(id: string): Promise<{ id: string, name: string, content: string, metadata: any }> { 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 = JSON.parse(metadataStr); return { id, name: metadata.name, content, metadata, }; } catch (error) { throw new ExcalidrawResourceNotFoundError(`Drawing with ID ${id} not found`); } }

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/i-tozer/excalidraw-mcp'

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