list_books
Retrieve a paginated list of books available in BookStack, with options to sort results and control display count for efficient content browsing.
Instructions
Get a listing of books visible to the user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| count | No | Number of items per page | |
| sort | No | Sort parameter |
Implementation Reference
- src/tools/content-tools.ts:547-551 (handler)The handler case for 'list_books' that validates input with PaginationSchema, calls client.getBooks(params), and formats the paginated response using formatApiResponse.case "list_books": { const params = PaginationSchema.parse(args); const result = await client.getBooks(params); return formatApiResponse(result.data, result.total); }
- src/tools/content-tools.ts:35-46 (schema)Tool metadata and input schema definition for 'list_books', specifying optional pagination parameters.{ name: "list_books", description: "Get a listing of books visible to the user", inputSchema: { type: "object", properties: { page: { type: "number", description: "Page number for pagination" }, count: { type: "number", description: "Number of items per page" }, sort: { type: "string", description: "Sort parameter" }, }, }, },
- src/lib/validation.ts:5-11 (schema)Zod validation schema for pagination parameters used in the list_books handler.export const PaginationSchema = z .object({ page: z.number().optional(), count: z.number().optional(), sort: z.string().optional(), }) .optional();
- src/index.ts:56-59 (registration)Incorporates the list_books tool (via createContentTools) into the complete list of tools advertised to the MCP client via listTools.const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ];
- src/index.ts:124-127 (registration)Dispatch logic in callTool handler that routes 'list_books' calls (as part of contentToolNames) to the appropriate handleContentTool function.if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient);