search_all
Search across books, chapters, pages, and shelves in BookStack to quickly find specific content using a query string.
Instructions
Search across all content types (books, chapters, pages, shelves) in BookStack
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of items per page (default 20, max 500) | |
| page | No | Page number for pagination | |
| query | Yes | Search query string (required) |
Implementation Reference
- src/tools/search-user-tools.ts:337-354 (handler)Implements the core logic for the 'search_all' tool: validates input, calls BookStackClient.search with query and optional pagination, and formats the response.case "search_all": { const { query, page, count } = args; if (!query || typeof query !== "string") { throw new Error("Search query is required and must be a string"); } const params = { query, page: page ? parseInteger(page) : undefined, count: count ? parseInteger(count) : undefined, }; const result = await client.search(query, { page: page ? parseInteger(page) : undefined, count: count ? parseInteger(count) : undefined, }); return formatApiResponse(result.data, result.total); }
- src/tools/search-user-tools.ts:13-35 (schema)Defines the metadata, description, and input schema for the 'search_all' tool, specifying the required 'query' parameter and optional pagination.{ name: "search_all", description: "Search across all content types (books, chapters, pages, shelves) in BookStack", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query string (required)", }, page: { type: "number", description: "Page number for pagination", }, count: { type: "number", description: "Number of items per page (default 20, max 500)", }, }, required: ["query"], }, },
- src/index.ts:56-59 (registration)Adds the 'search_all' tool to the list of available tools served by the MCP server via createSearchAndUserTools.const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ];
- src/index.ts:103-130 (registration)Registers the dispatch handler for 'search_all' by including it in searchUserToolNames and routing tool calls to handleSearchAndUserTool.const searchUserToolNames = [ "search_all", "list_users", "get_user", "create_user", "update_user", "delete_user", "list_roles", "get_role", "create_role", "update_role", "delete_role", "list_attachments", "get_attachment", "delete_attachment", "list_images", "get_image", "update_image", "delete_image", ]; if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient); } else { throw new Error(`Unknown tool: ${name}`); }