Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

get_chapters

Retrieve chapter listings from BookStack documentation, with options to filter by specific book ID and manage pagination for organized content navigation.

Instructions

List chapters, optionally filtered by book

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
book_idNoFilter by book ID
offsetNoPagination offset
countNoNumber of results to return

Implementation Reference

  • The implementation of the getChapters method which fetches chapters from the API.
    async getChapters(bookId?: number, offset = 0, count = 50): Promise<any> {
      const params: any = { offset, count };
      if (bookId) params.filter = JSON.stringify({ book_id: bookId });
    
      const response = await this.client.get('/chapters', { params });
      const data = response.data;
    
      return {
        ...data,
        data: await Promise.all(data.data.map((chapter: Chapter) => this.enhanceChapterResponse(chapter)))
      };
    }
  • src/index.ts:196-213 (registration)
    Registration of the 'get_chapters' tool and the request handler.
    server.registerTool(
      "get_chapters",
      {
        title: "List Chapters",
        description: "List chapters, optionally filtered by book",
        inputSchema: {
          book_id: z.coerce.number().optional().describe("Filter by book ID"),
          offset: z.coerce.number().default(0).describe("Pagination offset"),
          count: z.coerce.number().default(50).describe("Number of results to return")
        }
      },
      async (args) => {
        const chapters = await client.getChapters(args.book_id, args.offset, args.count);
        return {
          content: [{ type: "text", text: JSON.stringify(chapters, 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