Skip to main content
Glama

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
NameRequiredDescriptionDefault
folderNo폴더 필터: pages 또는 journals

Implementation Reference

  • Core handler function in GraphService that lists all pages/journals, extracts metadata (tags, links), computes backlinks, and filters by folder
    async 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;
    }
  • MCP server tool handler for 'list_pages': parses input arguments using Zod schema and delegates to GraphService.listPages
    case 'list_pages': {
      const { folder } = ListPagesSchema.parse(args);
      const pages = await graph.listPages(folder);
      return {
        content: [{ type: 'text', text: JSON.stringify(pages, null, 2) }],
      };
    }
  • Zod schema for validating input parameters (folder filter) of the list_pages tool
    const 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' },
        },
      },
    },

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/dearcloud09/logseq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server