Skip to main content
Glama
Lspace-io

Lspace MCP Server

Official
by Lspace-io

lspace_list_knowledge_base_history

Track and display all knowledge base changes, including file uploads and generation events, in a human-readable format. Filter by change type and limit results for precise insights.

Instructions

📜 HISTORY: List all changes made to the knowledge base in human-friendly format. Shows both file uploads and knowledge base generations separately. Example: repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
changeTypeNoFilter by type of change: 'file_upload', 'knowledge_base_generation', or 'both'
limitNoMaximum number of changes to return (default: 20)
repositoryIdYesThe ID of the Lspace repository. Use 'lspace_list_repositories' first to get repository IDs.

Implementation Reference

  • Tool registration entry defining name, description, and input schema
    {
      name: "lspace_list_knowledge_base_history",
      description: "📜 HISTORY: List all changes made to the knowledge base in human-friendly format. Shows both file uploads and knowledge base generations separately. Example: repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb'",
      inputSchema: {
        type: "object",
        properties: {
          repositoryId: {
            type: "string",
            description: "The ID of the Lspace repository. Use 'lspace_list_repositories' first to get repository IDs."
          },
          limit: {
            type: "number",
            description: "Maximum number of changes to return (default: 20)"
          },
          changeType: {
            type: "string",
            description: "Filter by type of change: 'file_upload', 'knowledge_base_generation', or 'both'",
            enum: ["file_upload", "knowledge_base_generation", "both"]
          }
        },
        required: ["repositoryId"]
      }
    },
  • MCP server handler for the tool: validates input, calls KnowledgeBaseHistoryService.listKnowledgeBaseChanges, formats response, handles errors
    case 'lspace_list_knowledge_base_history':
      const { repositoryId: historyRepoId, limit: historyLimit, changeType } = args;
      if (!historyRepoId) {
        return {
          jsonrpc: "2.0",
          id,
          error: {
            code: -32000,
            message: `Missing required parameter: repositoryId. Use 'lspace_list_repositories' to get repository IDs.`
          }
        };
      }
    
      try {
        const changes = await this.historyService.listKnowledgeBaseChanges(historyRepoId, {
          limit: historyLimit || 20,
          changeType: changeType || 'both'
        });
    
        return {
          jsonrpc: "2.0",
          id,
          result: {
            content: [
              {
                type: "text",
                text: this.formatHistoryResponse(changes, changeType || 'both')
              }
            ]
          }
        };
      } catch (error) {
        return {
          jsonrpc: "2.0",
          id,
          error: {
            code: -32000,
            message: `Error retrieving history: ${error.message}`
          }
        };
      }
  • Helper function to format history changes into human-readable text response
    formatHistoryResponse(changes, changeType) {
      if (changes.length === 0) {
        return `No ${changeType === 'both' ? '' : changeType + ' '}changes found in the knowledge base history.`;
      }
    
      let response = `Knowledge Base History (${changes.length} change${changes.length === 1 ? '' : 's'}):\n\n`;
      
      changes.forEach((change, index) => {
        const typeIcon = change.changeType === 'file_upload' ? '📄' : '🧠';
        const operationIcon = change.operation === 'added' ? '➕' : change.operation === 'updated' ? '✏️' : '🗑️';
        
        response += `${index + 1}. ${typeIcon} ${operationIcon} ${change.description}\n`;
        response += `   ID: ${change.id}\n`;
        response += `   When: ${change.userFriendlyDate}\n`;
        response += `   Type: ${change.changeType.replace('_', ' ')}\n`;
        if (change.details?.user) response += `   User: ${change.details.user}\n`;
        if (change.filesAffected.length > 0) response += `   Files: ${change.filesAffected.join(', ')}\n`;
        response += '\n';
      });
    
      response += `💡 Use 'lspace_undo_knowledge_base_changes' to revert any of these changes.\n`;
      response += `📋 Refer to changes by their ID or use human-friendly commands like:\n`;
      response += `   • "undo changes for filename.txt"\n`;
      response += `   • "undo last 3 changes"\n`;
      response += `   • revertType options: 'file_upload', 'knowledge_base_generation', 'both'`;
    
      return response;
    }
  • Core implementation: retrieves timeline history, converts to KnowledgeBaseChange objects distinguishing file uploads and KB generations, applies filters
    async listKnowledgeBaseChanges(
      repositoryId: string,
      options: { 
        limit?: number; 
        includeDetails?: boolean;
        changeType?: 'file_upload' | 'knowledge_base_generation' | 'both';
      } = {}
    ): Promise<KnowledgeBaseChange[]> {
      const repository = this.repositoryManager.getRepository(repositoryId);
      
      const filterOptions: TimelineFilterOptions = {
        limit: options.limit || 20,
        offset: 0
      };
    
      const historyEntries = await this.timelineService.getDetailedHistoryEntries(repository, filterOptions);
      
      const changes = historyEntries.flatMap(entry => this.convertToKnowledgeBaseChanges(entry));
      
      // Filter by change type if specified
      if (options.changeType && options.changeType !== 'both') {
        return changes.filter(change => change.changeType === options.changeType);
      }
      
      return changes;
    }
  • Type definition for KnowledgeBaseChange used in history listing
    export interface KnowledgeBaseChange {
      id: string;
      timestamp: string;
      description: string; // Human-friendly description
      operation: 'added' | 'updated' | 'removed' | 'organized';
      changeType: 'file_upload' | 'knowledge_base_generation'; // Key distinction!
      filesAffected: string[];
      userFriendlyDate: string;
      canRevert: boolean;
      internalCommitId: string;
      relatedCommitId?: string; // Links file upload to its KB generation
      details?: {
        title?: string;
        user?: string;
        category?: string;
        sourceFile?: string; // For KB changes, which file triggered them
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It discloses that the tool lists changes in a 'human-friendly format' and separates file uploads from knowledge base generations, which adds behavioral context. However, it lacks details on permissions, rate limits, or response format, leaving gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, uses an emoji for visual clarity, and includes a concise example. Every sentence earns its place without redundancy, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is moderately complete. It covers the tool's purpose and basic behavior but lacks details on output format, error handling, or integration with sibling tools, which could help an agent use it more effectively in context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds minimal value by mentioning repositoryId in an example, but does not provide additional meaning or usage context beyond what the schema already specifies for parameters like changeType or limit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('List all changes') and resource ('knowledge base'), and distinguishes it from siblings by specifying it shows history in 'human-friendly format' with both file uploads and knowledge base generations separately, unlike other tools like lspace_list_repositories or lspace_search_knowledge_base.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool (to see history of changes) and includes an example with repositoryId, but does not explicitly state when not to use it or name alternatives among siblings, such as lspace_browse_knowledge_base for current content.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/Lspace-io/lspace-server'

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