Skip to main content
Glama

list_drawings

Retrieve and browse all available Excalidraw drawings with pagination support to organize and access your diagram collection efficiently.

Instructions

List all Excalidraw drawings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
perPageNo

Implementation Reference

  • The core handler function that implements the list_drawings tool logic: reads metadata files from storage directory, applies pagination, and returns list of drawings with total count.
    export async function listDrawings( page: number = 1, perPage: number = 10 ): Promise<{ drawings: any[]; total: number }> { await ensureStorageDir(); try { // Get all files in the storage directory const files = await fs.readdir(STORAGE_DIR); // Filter metadata files const metadataFiles = files.filter((file) => file.endsWith(".meta.json")); // Calculate pagination const start = (page - 1) * perPage; const end = start + perPage; const paginatedFiles = metadataFiles.slice(start, end); // Read metadata for each drawing const drawings = await Promise.all( paginatedFiles.map(async (file) => { const metadataPath = path.join(STORAGE_DIR, file); const metadataStr = await fs.readFile(metadataPath, "utf-8"); return safeJsonParse(metadataStr, "drawing metadata"); }) ); return { drawings, total: metadataFiles.length, }; } catch (error) { console.error("Failed to list drawings:", sanitizeErrorMessage(error)); return { drawings: [], total: 0, }; } }
  • Zod schema defining input parameters for the list_drawings tool: optional page (default 1) and perPage (default 10, max 100).
    export const ListDrawingsSchema = z.object({ page: z.number().int().min(1).optional().default(1), perPage: z.number().int().min(1).max(100).optional().default(10), });
  • src/index.ts:85-89 (registration)
    Tool registration in the MCP server's listTools response, specifying name, description, and input schema.
    { name: "list_drawings", description: "List all Excalidraw drawings", inputSchema: zodToJsonSchema(drawings.ListDrawingsSchema), },
  • MCP server dispatch handler for list_drawings: parses arguments using schema and invokes the core listDrawings function.
    case "list_drawings": { const args = drawings.ListDrawingsSchema.parse( request.params.arguments ); const result = await drawings.listDrawings(args.page, args.perPage); 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