list_screens
List all generated iOS mockup screens. Use the project filter to find screens for a specific project.
Instructions
List all generated screens, optionally filtered by project name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | No | Filter by project. Omit to list all. |
Implementation Reference
- src/server.ts:37-39 (schema)Zod schema (listInput) for the list_screens tool input. Accepts an optional 'project' string parameter to filter screens by project.
const listInput = z.object({ project: z.string().optional().describe("Filter by project. Omit to list all."), }); - src/server.ts:61-65 (registration)Tool definition registration of 'list_screens' in the TOOLS array. Defines name, description, and inputSchema for the MCP tool.
{ name: "list_screens", description: "List all generated screens, optionally filtered by project name.", inputSchema: zodToJson(listInput), }, - src/server.ts:128-129 (registration)Routes the 'list_screens' tool call to handleList() in the CallToolRequestSchema handler.
case "list_screens": return await handleList(listInput.parse(args)); - src/server.ts:225-239 (handler)handleList() — the handler function for the list_screens tool. Calls listScreens() with optional project filter, formats results into a text list showing ID, project, name, date, and parent reference.
async function handleList(input: z.infer<typeof listInput>) { const screens = await listScreens(input.project); if (screens.length === 0) { return { content: [{ type: "text" as const, text: "No screens found." }], }; } const lines = screens.map( (s) => `- [${s.id}] ${s.project} / ${s.name} (${s.createdAt})${s.parentId ? ` ← ${s.parentId.slice(0, 8)}` : ""}` ); return { content: [{ type: "text" as const, text: lines.join("\n") }], }; } - src/storage.ts:105-119 (helper)listScreens() — the storage helper that reads all .json metadata files from project directories. Filters by project if specified, returns screens sorted by creation date descending.
export async function listScreens(project?: string): Promise<SavedScreen[]> { const projects = project ? [slug(project)] : await listProjects(); const result: SavedScreen[] = []; for (const p of projects) { const dir = join(DESIGNS_DIR, p); const files = await readdir(dir).catch(() => []); for (const f of files) { if (f.endsWith(".json")) { const meta = JSON.parse(await readFile(join(dir, f), "utf8")) as SavedScreen; result.push(meta); } } } return result.sort((a, b) => b.createdAt.localeCompare(a.createdAt)); }