Skip to main content
Glama
ttpears

BookStack MCP Server

by ttpears

get_recent_changes

Retrieve recently updated BookStack content with previews and change details to track documentation modifications.

Instructions

Get recently updated content with contextual previews and change descriptions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoFilter by content typeall
limitNoNumber of recent items to return
daysNoNumber of days back to look for changes

Implementation Reference

  • The actual implementation of getRecentChanges, which builds the query and interacts with the BookStack API.
    async getRecentChanges(options?: {
      type?: 'all' | 'page' | 'book' | 'chapter';
      limit?: number;
      days?: number;
    }): Promise<any> {
      const limit = Math.min(options?.limit || 20, 100);
      const days = options?.days || 30;
      const type = options?.type || 'all';
      
      // Calculate date threshold
      const dateThreshold = new Date();
      dateThreshold.setDate(dateThreshold.getDate() - days);
      const dateFilter = dateThreshold.toISOString().split('T')[0]; // YYYY-MM-DD format
      
      // Build search query for recent changes
      let searchQuery = `{updated_at:>=${dateFilter}}`;
      if (type !== 'all') {
        searchQuery = `{type:${type}} ${searchQuery}`;
      }
      
      const params = {
        query: searchQuery,
        count: limit,
        sort: 'updated_at' // Sort by most recently updated
      };
      
      const response = await this.client.get('/search', { params });
      const results = response.data.data || response.data;
      
      // Enhance results with additional context
      const enhancedResults = await Promise.all(
        results.map(async (result: SearchResult) => {
          let contextualInfo = '';
          let contentPreview = result.preview_content?.content || '';
          
          try {
            // Get additional context based on content type
            if (result.type === 'page' && result.id) {
              const fullPage = await this.client.get(`/pages/${result.id}`);
              const pageData = fullPage.data;
              contentPreview = pageData.text?.substring(0, 200) || contentPreview;
              contextualInfo = `Updated in book: ${pageData.book?.name || 'Unknown Book'}`;
              if (pageData.chapter) {
                contextualInfo += `, chapter: ${pageData.chapter.name}`;
              }
            } else if (result.type === 'book' && result.id) {
  • src/index.ts:338-359 (registration)
    The registration of the 'get_recent_changes' MCP tool, including its schema and the handler that calls the client method.
    server.registerTool(
      "get_recent_changes",
      {
        title: "Get Recent Changes",
        description: "Get recently updated content with contextual previews and change descriptions",
        inputSchema: {
          type: z.enum(["all", "page", "book", "chapter"]).default("all").describe("Filter by content type"),
          limit: z.coerce.number().max(100).default(20).describe("Number of recent items to return"),
          days: z.coerce.number().default(30).describe("Number of days back to look for changes")
        }
      },
      async (args) => {
        const changes = await client.getRecentChanges({
          type: args.type,
          limit: args.limit,
          days: args.days
        });
        return {
          content: [{ type: "text", text: JSON.stringify(changes, 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