Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

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
NameRequiredDescriptionDefault
offsetNoPagination offset
countNoNumber of results to return
sortNoSort field
filterNoFilter criteria

Implementation Reference

  • 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) }]
        };
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ttpears/bookstack-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server