search_content
Search BookStack documentation content with contextual previews and location details using advanced query syntax.
Instructions
Search across BookStack content with contextual previews and location info
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query. Use BookStack advanced search syntax like {type:page} or {book_id:5} | |
| type | No | Filter by content type | |
| count | No | Number of results to return (max 500) | |
| offset | No | Number of results to skip for pagination |
Implementation Reference
- src/bookstack-client.ts:276-295 (handler)The actual implementation of the search_content tool, which calls the BookStack API with search parameters and processes the results.
async searchContent(query: string, options?: { type?: 'book' | 'page' | 'chapter' | 'bookshelf'; count?: number; offset?: number; }): Promise<any> { let searchQuery = query; // Use advanced search syntax for type filtering if (options?.type) { searchQuery = `{type:${options.type}} ${query}`.trim(); } const params: any = { query: searchQuery }; if (options?.count) params.count = Math.min(options.count, 500); // BookStack max if (options?.offset) params.offset = options.offset; const response = await this.client.get('/search', { params }); const results = response.data.data || response.data; return await this.enhanceSearchResults(results, query); - src/index.ts:60-80 (registration)MCP tool registration for "search_content", defining the schema and the handler that calls the bookstack client.
server.registerTool( "search_content", { title: "Search BookStack Content", description: "Search across BookStack content with contextual previews and location info", inputSchema: { query: z.string().describe("Search query. Use BookStack advanced search syntax like {type:page} or {book_id:5}"), type: z.enum(["book", "page", "chapter", "bookshelf"]).optional().describe("Filter by content type"), count: z.coerce.number().max(500).optional().describe("Number of results to return (max 500)"), offset: z.coerce.number().optional().describe("Number of results to skip for pagination") } }, async (args) => { const results = await client.searchContent(args.query, { type: args.type, count: args.count, offset: args.offset }); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };