list_shelves
Retrieve a paginated list of shelves accessible to the user from a BookStack wiki instance, with options to sort results and control page size.
Instructions
Get a listing of shelves visible to the user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of items per page | |
| page | No | Page number for pagination | |
| sort | No | Sort parameter |
Implementation Reference
- src/tools/content-tools.ts:733-737 (handler)The handler function for the 'list_shelves' tool within handleContentTool. It validates input with PaginationSchema, calls the BookStackClient's getShelves method, and formats the paginated API response.case "list_shelves": { const params = PaginationSchema.parse(args); const result = await client.getShelves(params); return formatApiResponse(result.data, result.total); }
- src/tools/content-tools.ts:425-436 (schema)The input schema and metadata definition for the 'list_shelves' tool, returned by createContentTools for MCP tool listing.name: "list_shelves", description: "Get a listing of shelves 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/bookstack-client.ts:258-260 (helper)The BookStackClient method implementing the API call to list shelves, using the private 'get' helper for paginated GET request to /shelves endpoint.async getShelves(params?: PaginationParams): Promise<ApiResponse<Shelf[]>> { return this.get<Shelf>("/shelves", params); }
- src/index.ts:124-127 (registration)Registration and dispatch logic in the MCP call tool handler, routing 'list_shelves' (included in contentToolNames) to handleContentTool.if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient);
- src/index.ts:62-66 (registration)MCP list tools request handler registration, providing allTools which includes 'list_shelves' from createContentTools.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: allTools, }; });