Skip to main content
Glama

search_pages

Retrieve WikiJS pages by entering a search query, optionally narrowing results by path or locale, enabling efficient content discovery and integration.

Instructions

Search for pages in WikiJS by query string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
localeNoOptional locale for the search (e.g., "en")
pathNoOptional path to limit search scope
queryYesSearch query to find pages

Implementation Reference

  • The createTool function returns the MCP tool handler for 'search_pages'. It extracts parameters from the request, calls wikiClient.searchPages, and returns the result as formatted JSON text content.
    export const createTool = (wikiClient: WikiJSClient): ToolCallback<typeof PARAMETERS> => { return async (request) => { const { query, path, locale } = request const result = await wikiClient.searchPages(query, path, locale); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } }
  • Zod schema defining the input parameters for the search_pages tool: query (required string), path (optional string), locale (optional valid locale string).
    export const PARAMETERS = { query: z.string().min(1, 'Query cannot be empty').describe('Search query to find pages'), path: z.string().optional().describe('Optional path to limit search scope'), locale: z.string().regex(/^[a-z]{2}(-[A-Z]{2})?$/, 'Invalid locale format').optional().describe('Optional locale for the search (e.g., "en")') };
  • src/mcp/index.ts:41-45 (registration)
    Registration of the 'search_pages' tool on the MCP server using server.tool, providing name, description, parameters schema, and the handler function from createSearchPagesTool.
    server.tool( 'search_pages', 'Search for pages in WikiJS by query string', SEARCH_PAGES_TOOL_PARAMETERS, createSearchPagesTool(this.wikiClient));
  • Helper method on WikiJSClient that performs the GraphQL search for pages using the SDK and handles fallback for empty results.
    async searchPages(query: string, path?: string, locale?: string) { const result = await this.sdk.SearchPages({ query, path, locale }); return result.pages?.search || { results: [], suggestions: [], totalHits: 0 }; }

Other Tools

Related Tools

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/RicardoCenci/wikijs-mcp'

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