get_all_pages
Retrieve all pages from a WikiJS knowledge base using the MCP server, enabling efficient content management and integration with AI assistants for seamless access to stored information.
Instructions
Get all pages in WikiJS
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/tools/getAllPages.ts:7-33 (handler)The createTool function that defines the handler for the 'get_all_pages' tool. It calls wikiClient.getAllPages(), formats the result as JSON text, or returns an error message.
export const createTool = (wikiClient: WikiJSClient): ToolCallback<typeof PARAMETERS> => { return async () => { try { const result = await wikiClient.getAllPages(); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: 'text', text: `Error getting page by ID: ${errorMessage}` } ], isError: true }; } } } - src/mcp/tools/getAllPages.ts:4-4 (schema)The input parameters schema for the 'get_all_pages' tool (empty object).
export const PARAMETERS = {}; - src/mcp/index.ts:61-66 (registration)Registration of the 'get_all_pages' tool on the MCP server using server.tool() with name, description, parameters, and the created handler function.
server.tool( 'get_all_pages', 'Get all pages in WikiJS', GET_ALL_PAGES_TOOL_PARAMETERS, createGetAllPagesTool(this.wikiClient) ); - src/wikijs/index.ts:27-30 (helper)The WikiJSClient.getAllPages helper method invoked by the tool handler, which calls the GraphQL SDK to fetch all pages.
async getAllPages({limit, locale, tags}: {limit?: number, locale?: string, tags?: string[]} = {}) { const result = await this.sdk.GetAllPages({ limit, locale, tags }); return result.pages?.list || []; }