get_shelves
Retrieve and manage book shelf collections in BookStack with filtering, sorting, and pagination controls.
Instructions
List available book shelves (collections) with filtering and sorting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| offset | No | Pagination offset | |
| count | No | Number of results to return | |
| sort | No | Sort field | |
| filter | No | Filter criteria |
Implementation Reference
- src/bookstack-client.ts:639-660 (handler)The handler method in the Bookstack client that performs the actual API call to fetch shelves.
async getShelves(options?: { offset?: number; count?: number; sort?: string; filter?: Record<string, any>; }): Promise<ListResponse<Shelf>> { const params: any = { offset: options?.offset || 0, count: Math.min(options?.count || 50, 500) }; if (options?.sort) params.sort = options.sort; if (options?.filter) params.filter = JSON.stringify(options.filter); const response = await this.client.get('/shelves', { params }); const data = response.data; return { ...data, data: data.data.map((shelf: Shelf) => this.enhanceShelfResponse(shelf)) }; } - src/index.ts:361-385 (registration)The MCP tool registration for 'get_shelves' which invokes the client's getShelves method.
server.registerTool( "get_shelves", { title: "List Shelves", description: "List available book shelves (collections) with filtering and sorting", inputSchema: { offset: z.coerce.number().default(0).describe("Pagination offset"), count: z.coerce.number().max(500).default(50).describe("Number of results to return"), sort: z.string().optional().describe("Sort field"), filter: z.record(z.any()).optional().describe("Filter criteria") } }, async (args) => { const shelves = await client.getShelves({ offset: args.offset, count: args.count, sort: args.sort, filter: args.filter }); return { content: [{ type: "text", text: JSON.stringify(shelves, null, 2) }] }; } );