Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

search_pages

Find pages in BookStack by search query, optionally filtering results to specific books for targeted documentation discovery.

Instructions

Search specifically for pages with optional book filtering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for pages
book_idNoFilter results to pages within a specific book
countNoNumber of results to return
offsetNoPagination offset

Implementation Reference

  • The actual implementation of the search_pages tool logic.
    async searchPages(query: string, options?: {
      bookId?: number;
      count?: number;
      offset?: number;
    }): Promise<any> {
      let searchQuery = `{type:page} ${query}`.trim();
    
      // Add book filtering if specified
      if (options?.bookId) {
        searchQuery = `{book_id:${options.bookId}} ${searchQuery}`;
      }
    
      const params: any = { query: searchQuery };
      if (options?.count) params.count = Math.min(options.count, 500);
      if (options?.offset) params.offset = options.offset;
    
      const response = await this.client.get('/search', { params });
      const results = response.data.data || response.data;
    
      return await this.enhanceSearchResults(results, query);
    }
  • src/index.ts:84-106 (registration)
    The registration of the search_pages tool in the MCP server.
    server.registerTool(
      "search_pages",
      {
        title: "Search Pages",
        description: "Search specifically for pages with optional book filtering",
        inputSchema: {
          query: z.string().describe("Search query for pages"),
          book_id: z.coerce.number().optional().describe("Filter results to pages within a specific book"),
          count: z.coerce.number().max(500).optional().describe("Number of results to return"),
          offset: z.coerce.number().optional().describe("Pagination offset")
        }
      },
      async (args) => {
        const results = await client.searchPages(args.query, {
          bookId: args.book_id,
          count: args.count,
          offset: args.offset
        });
        return {
          content: [{ type: "text", text: JSON.stringify(results, 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