Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

get_pages

Retrieve and filter BookStack documentation pages with content previews, word counts, and contextual information to locate specific content efficiently.

Instructions

List pages with content previews, word counts, and contextual information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idNoFilter by book ID
chapter_idNoFilter by chapter ID
offsetNoPagination offset
countNoNumber of results to return
sortNoSort field
filterNoAdditional filter criteria

Implementation Reference

  • The implementation of getPages, which makes the API call to BookStack to fetch page lists.
    async getPages(options?: {
      bookId?: number;
      chapterId?: number;
      offset?: number;
      count?: number;
      sort?: string;
      filter?: Record<string, any>;
    }): Promise<ListResponse<Page>> {
      const params: any = {
        offset: options?.offset || 0,
        count: Math.min(options?.count || 50, 500)
      };
    
      // Build filter object
      const filter: any = { ...options?.filter };
      if (options?.bookId) filter.book_id = options.bookId;
      if (options?.chapterId) filter.chapter_id = options.chapterId;
    
      if (Object.keys(filter).length > 0) {
        params.filter = JSON.stringify(filter);
      }
    
      if (options?.sort) params.sort = options.sort;
    
      const response = await this.client.get('/pages', { params });
      const data = response.data;
    
      return {
        ...data,
        data: await Promise.all(data.data.map((page: Page) => this.enhancePageResponse(page)))
      };
    }
  • src/index.ts:150-177 (registration)
    Tool registration for 'get_pages', defining its input schema and invoking the handler.
    server.registerTool(
      "get_pages",
      {
        title: "List Pages",
        description: "List pages with content previews, word counts, and contextual information",
        inputSchema: {
          book_id: z.coerce.number().optional().describe("Filter by book ID"),
          chapter_id: z.coerce.number().optional().describe("Filter by chapter ID"),
          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("Additional filter criteria")
        }
      },
      async (args) => {
        const pages = await client.getPages({
          bookId: args.book_id,
          chapterId: args.chapter_id,
          offset: args.offset,
          count: args.count,
          sort: args.sort,
          filter: args.filter
        });
        return {
          content: [{ type: "text", text: JSON.stringify(pages, 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