Skip to main content
Glama

list_drawings

Retrieve and organize all Excalidraw drawings with pagination support for efficient management and accessibility. Use this tool to list drawings by specifying page and per-page parameters.

Instructions

List all Excalidraw drawings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNo
perPageNo

Implementation Reference

  • The main handler function that lists drawings with pagination by reading metadata files from storage directory.
    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 JSON.parse(metadataStr); }) ); return { drawings, total: metadataFiles.length, }; } catch (error) { console.error('Failed to list drawings:', error); return { drawings: [], total: 0, }; } }
  • Zod schema defining input parameters for the list_drawings tool: optional page and perPage.
    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), });
  • index.ts:83-86 (registration)
    Tool registration in the ListTools response, including name, description, and input schema reference.
    name: "list_drawings", description: "List all Excalidraw drawings", inputSchema: zodToJsonSchema(drawings.ListDrawingsSchema), },
  • Dispatch handler in the CallTool switch statement that parses args and calls the 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) }], }; }

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