list_pages
Retrieve all pages from your Logseq knowledge graph with metadata including paths, names, tags, links, and backlinks. Filter results by pages or journals folders.
Instructions
Graph 내 모든 페이지 목록 조회. 각 페이지의 메타데이터(경로, 이름, 태그, 링크, 백링크) 반환
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folder | No | 폴더 필터: pages 또는 journals |
Implementation Reference
- src/graph.ts:28-63 (handler)Core handler function in GraphService that lists all pages/journals, extracts metadata (tags, links), computes backlinks, and filters by folderasync listPages(folder?: string): Promise<PageMetadata[]> { const pages: PageMetadata[] = []; const backlinksMap = new Map<string, string[]>(); // Collect all pages first to build backlinks const allPages = await this.collectAllPages(); // Build backlinks map for (const page of allPages) { for (const link of page.links) { const existing = backlinksMap.get(link) || []; existing.push(page.name); backlinksMap.set(link, existing); } } // Filter by folder if specified let filteredPages = allPages; if (folder) { if (folder === 'journals') { filteredPages = allPages.filter(p => p.isJournal); } else if (folder === 'pages') { filteredPages = allPages.filter(p => !p.isJournal); } } // Add backlinks to each page for (const page of filteredPages) { pages.push({ ...page, backlinks: backlinksMap.get(page.name) || [], }); } return pages; }
- src/index.ts:250-256 (handler)MCP server tool handler for 'list_pages': parses input arguments using Zod schema and delegates to GraphService.listPagescase 'list_pages': { const { folder } = ListPagesSchema.parse(args); const pages = await graph.listPages(folder); return { content: [{ type: 'text', text: JSON.stringify(pages, null, 2) }], }; }
- src/index.ts:56-58 (schema)Zod schema for validating input parameters (folder filter) of the list_pages toolconst ListPagesSchema = z.object({ folder: z.enum(['pages', 'journals']).optional().describe('폴더 필터: pages 또는 journals'), });
- src/index.ts:111-120 (registration)Registration of the list_pages tool in the MCP tools list, including name, description, and JSON input schema{ name: 'list_pages', description: 'Graph 내 모든 페이지 목록 조회. 각 페이지의 메타데이터(경로, 이름, 태그, 링크, 백링크) 반환', inputSchema: { type: 'object' as const, properties: { folder: { type: 'string', enum: ['pages', 'journals'], description: '폴더 필터: pages 또는 journals' }, }, }, },