Skip to main content
Glama

list_chapters

Retrieve a paginated listing of chapters accessible to the user from a BookStack wiki, with options to sort results and control page size.

Instructions

Get a listing of chapters visible to the user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of items per page
pageNoPage number for pagination
sortNoSort parameter

Implementation Reference

  • Handler function for the 'list_chapters' tool. Parses input arguments using PaginationSchema, fetches chapters via BookStackClient.getChapters, and formats the paginated response.
    case "list_chapters": { const params = PaginationSchema.parse(args); const result = await client.getChapters(params); return formatApiResponse(result.data, result.total); }
  • Zod schema used for validating the input parameters (page, count, sort) of the list_chapters tool.
    export const PaginationSchema = z .object({ page: z.number().optional(), count: z.number().optional(), sort: z.string().optional(), }) .optional();
  • Tool registration in createContentTools function, defining name, description, and inputSchema for MCP tool listing.
    { name: "list_chapters", description: "Get a listing of chapters 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/index.ts:56-59 (registration)
    Registration of all tools including content tools (containing list_chapters) for the MCP server.
    const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ];
  • BookStackClient method that implements the API call to fetch list of chapters using the private get helper.
    async getChapters( params?: PaginationParams ): Promise<ApiResponse<Chapter[]>> { return this.get<Chapter>("/chapters", params); }

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/lautarobarba/bookstack_mcp_server'

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