list_images
Retrieve all stored images from the EverArt Forge MCP Server to manage and access generated AI artwork.
Instructions
List all stored images
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:736-791 (handler)Main handler for the 'list_images' tool. Lists images from storage directory using listStoredImages helper, groups by file type, formats a detailed text response with counts and recent file URLs.case "list_images": { try { const files = await listStoredImages(); if (files.length === 0) { return { content: [{ type: "text", text: "No stored images found. Try generating some images first!" }], }; } // Group files by type for better display const filesByType: Record<string, string[]> = {}; for (const file of files) { const ext = path.extname(file).slice(1).toLowerCase(); if (!filesByType[ext]) { filesByType[ext] = []; } filesByType[ext].push(file); } let resultText = "📁 Stored images:\n\n"; for (const [type, typeFiles] of Object.entries(filesByType)) { resultText += `${type.toUpperCase()} Files (${typeFiles.length}):\n`; resultText += typeFiles.map(f => `• ${f}`).join("\n"); resultText += "\n\n"; } resultText += `Total: ${files.length} file(s)`; // Add file URLs instead of trying to embed images const recentFiles = files.slice(-5); const fileUrls: string[] = []; for (const file of recentFiles) { const filepath = path.join(STORAGE_DIR, file); fileUrls.push(`file://${filepath}`); } return { content: [ { type: "text", text: resultText }, ...(fileUrls.length > 0 ? [{ type: "text", text: "\nRecent images:\n" + fileUrls.map(url => `• ${url}`).join('\n') }] : []), ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error"; return errorResponse({ type: EverArtErrorType.STORAGE_ERROR, message: `Error listing images: ${errorMessage}` }); } }
- src/index.ts:310-320 (helper)Helper function that reads the STORAGE_DIR and returns an array of image files matching supported extensions (svg, png, jpg, jpeg, webp). Handles missing directory gracefully.async function listStoredImages(): Promise<string[]> { try { const files = await fs.readdir(STORAGE_DIR); return files.filter((file: string) => /\.(svg|png|jpe?g|webp)$/i.test(file)); } catch (error) { if ((error as NodeJS.ErrnoException).code === "ENOENT") { return []; } throw error; } }
- src/index.ts:420-426 (registration)Tool registration in the ListToolsRequestSchema response, including name, description, and empty inputSchema (no parameters required).name: "list_images", description: "List all stored images", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:422-426 (schema)Input schema for list_images tool: empty object since no parameters are needed.inputSchema: { type: "object", properties: {}, }, },