Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

search_content

Search BookStack documentation content with contextual previews and location details using advanced query syntax.

Instructions

Search across BookStack content with contextual previews and location info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query. Use BookStack advanced search syntax like {type:page} or {book_id:5}
typeNoFilter by content type
countNoNumber of results to return (max 500)
offsetNoNumber of results to skip for pagination

Implementation Reference

  • The actual implementation of the search_content tool, which calls the BookStack API with search parameters and processes the results.
    async searchContent(query: string, options?: {
      type?: 'book' | 'page' | 'chapter' | 'bookshelf';
      count?: number;
      offset?: number;
    }): Promise<any> {
      let searchQuery = query;
    
      // Use advanced search syntax for type filtering
      if (options?.type) {
        searchQuery = `{type:${options.type}} ${query}`.trim();
      }
    
      const params: any = { query: searchQuery };
      if (options?.count) params.count = Math.min(options.count, 500); // BookStack max
      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:60-80 (registration)
    MCP tool registration for "search_content", defining the schema and the handler that calls the bookstack client.
    server.registerTool(
      "search_content",
      {
        title: "Search BookStack Content",
        description: "Search across BookStack content with contextual previews and location info",
        inputSchema: {
          query: z.string().describe("Search query. Use BookStack advanced search syntax like {type:page} or {book_id:5}"),
          type: z.enum(["book", "page", "chapter", "bookshelf"]).optional().describe("Filter by content type"),
          count: z.coerce.number().max(500).optional().describe("Number of results to return (max 500)"),
          offset: z.coerce.number().optional().describe("Number of results to skip for pagination")
        }
      },
      async (args) => {
        const results = await client.searchContent(args.query, {
          type: args.type,
          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