Skip to main content
Glama
Lspace-io

Lspace MCP Server

Official
by Lspace-io

lspace_add_content

Add text snippets, files, or URLs to the Lspace MCP Server for automated knowledge base generation. Specify repository ID, content type, and details to organize and store information efficiently.

Instructions

πŸš€ CREATE: Add content for automatic knowledge base generation. This is the PRIMARY tool for adding ANY content to lspace. Example: repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb', inputType='text_snippet', content='My documentation text', title='New Guide'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoThe actual content text (for text_snippet) or file content (for file_upload). For files, use base64 encoding for binary data.
fileNameNoFile name (REQUIRED for file_upload type). Example: 'my-document.md'
inputTypeYesContent type: 'text_snippet' for text, 'file_upload' for files, 'web_url' to fetch from URL.
metadataNoOptional metadata like tags, categories, etc.
repositoryIdYesThe ID of the Lspace repository. Use 'lspace_list_repositories' first to get repository IDs.
titleNoOptional title for the content. Example: 'Installation Guide', 'Meeting Notes'
urlNoThe URL to fetch content from (REQUIRED for web_url type). Example: 'https://example.com/doc'
userNoOptional user identifier. Example: 'john.doe'

Implementation Reference

  • The main handler for the 'lspace_add_content' MCP tool. Validates input parameters (repositoryId, inputType, content, etc.), handles different input types ('file_upload', 'text_snippet', 'web_url'), maps parameters to an input object, calls this.orchestratorService.processInput(input) to perform the core logic, and returns a formatted success response with processing details.
    case 'lspace_add_content':
      const { repositoryId: repoId, inputType, content, fileName, url, title } = args;
      if (!repoId || !inputType) {
        return {
          jsonrpc: "2.0",
          id,
          error: {
            code: -32000,
            message: `Missing required parameters for lspace_add_content:\n` +
                    `β€’ repositoryId: Get this from 'lspace_list_repositories'\n` +
                    `β€’ inputType: Use 'text_snippet', 'file_upload', or 'web_url'\n\n` +
                    `Example: repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb', inputType='text_snippet', content='My text', title='My Title'`
          }
        };
      }
      
      try {
        let input;
        
        // Map MCP input parameters to orchestrator service input types
        switch (inputType) {
          case 'file_upload':
            if (!fileName || !content) {
              return {
                jsonrpc: "2.0",
                id,
                error: {
                  code: -32000,
                  message: 'Missing required parameters for file_upload: fileName, content'
                }
              };
            }
            input = {
              type: 'file_upload',
              repositoryId: repoId,
              fileName,
              content
            };
            break;
            
          case 'text_snippet':
            if (!content) {
              return {
                jsonrpc: "2.0",
                id,
                error: {
                  code: -32000,
                  message: 'Missing required parameter for text_snippet: content'
                }
              };
            }
            input = {
              type: 'text_snippet',
              repositoryId: repoId,
              content,
              title
            };
            break;
            
          case 'web_url':
            if (!url) {
              return {
                jsonrpc: "2.0",
                id,
                error: {
                  code: -32000,
                  message: 'Missing required parameter for web_url: url'
                }
              };
            }
            input = {
              type: 'web_url',
              repositoryId: repoId,
              url
            };
            break;
            
          default:
            return {
              jsonrpc: "2.0",
              id,
              error: {
                code: -32000,
                message: `Unsupported input type: ${inputType}. Supported types: file_upload, text_snippet, web_url`
              }
            };
        }
        
        // Process the input using orchestrator service
        const result = await this.orchestratorService.processInput(input);
        
        return {
          jsonrpc: "2.0",
          id,
          result: {
            content: [
              {
                type: "text",
                text: `Content Successfully Processed!\n\nType: ${inputType}\nRepository: ${repoId}\n${fileName ? `File: ${fileName}\n` : ''}${url ? `URL: ${url}\n` : ''}${title ? `Title: ${title}\n` : ''}\n\nRaw Input Path: ${result.rawInputPath || 'N/A'}\nKnowledge Base Updated: ${result.knowledgeBaseUpdated}\nKB Article Path: ${result.knowledgeBasePath || 'N/A'}\n\nMessage: ${result.message || 'Content processed successfully'}`
              }
            ]
          }
        };
      } catch (error) {
        return {
          jsonrpc: "2.0",
          id,
          error: {
            code: -32000,
            message: `Error processing content: ${error.message}`
          }
        };
      }
  • Input/output schema and description for the 'lspace_add_content' tool, defining parameters like repositoryId (required), inputType (enum: text_snippet, file_upload, web_url), content, fileName, url, title, user, metadata.
      name: "lspace_add_content",
      description: "πŸš€ CREATE: Add content for automatic knowledge base generation. This is the PRIMARY tool for adding ANY content to lspace. Example: repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb', inputType='text_snippet', content='My documentation text', title='New Guide'",
      inputSchema: {
        type: "object",
        properties: {
          repositoryId: {
            type: "string",
            description: "The ID of the Lspace repository. Use 'lspace_list_repositories' first to get repository IDs."
          },
          inputType: {
            type: "string",
            description: "Content type: 'text_snippet' for text, 'file_upload' for files, 'web_url' to fetch from URL.",
            enum: ["text_snippet", "file_upload", "web_url"]
          },
          content: {
            type: "string",
            description: "The actual content text (for text_snippet) or file content (for file_upload). For files, use base64 encoding for binary data."
          },
          fileName: {
            type: "string",
            description: "File name (REQUIRED for file_upload type). Example: 'my-document.md'"
          },
          url: {
            type: "string",
            description: "The URL to fetch content from (REQUIRED for web_url type). Example: 'https://example.com/doc'"
          },
          title: {
            type: "string",
            description: "Optional title for the content. Example: 'Installation Guide', 'Meeting Notes'"
          },
          user: {
            type: "string",
            description: "Optional user identifier. Example: 'john.doe'"
          },
          metadata: {
            type: "object",
            description: "Optional metadata like tags, categories, etc."
          }
        },
        required: ["repositoryId", "inputType"]
      }
    },
  • The getTools() method registers 'lspace_add_content' (and other tools) by returning the tools list for the MCP 'tools/list' endpoint.
    getTools() {
      return [
        // === REPOSITORY MANAGEMENT ===
        {
          name: "lspace_list_repositories",
          description: "πŸ“‹ SETUP: List all repositories currently managed by Lspace.",
          inputSchema: {
            type: "object",
            properties: {},
            required: []
          }
        },
        {
          name: "lspace_get_repository_info",
          description: "ℹ️ SETUP: Get detailed configuration for a specific repository.",
          inputSchema: {
            type: "object",
            properties: {
              repositoryName: {
                type: "string",
                description: "The unique name of the repository."
              }
            },
            required: ["repositoryName"]
          }
        },
    
        // === CONTENT CREATION (PRIMARY WORKFLOW) ===
        {
          name: "lspace_add_content",
          description: "πŸš€ CREATE: Add content for automatic knowledge base generation. This is the PRIMARY tool for adding ANY content to lspace. Example: repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb', inputType='text_snippet', content='My documentation text', title='New Guide'",
          inputSchema: {
            type: "object",
            properties: {
              repositoryId: {
                type: "string",
                description: "The ID of the Lspace repository. Use 'lspace_list_repositories' first to get repository IDs."
              },
              inputType: {
                type: "string",
                description: "Content type: 'text_snippet' for text, 'file_upload' for files, 'web_url' to fetch from URL.",
                enum: ["text_snippet", "file_upload", "web_url"]
              },
              content: {
                type: "string",
                description: "The actual content text (for text_snippet) or file content (for file_upload). For files, use base64 encoding for binary data."
              },
              fileName: {
                type: "string",
                description: "File name (REQUIRED for file_upload type). Example: 'my-document.md'"
              },
              url: {
                type: "string",
                description: "The URL to fetch content from (REQUIRED for web_url type). Example: 'https://example.com/doc'"
              },
              title: {
                type: "string",
                description: "Optional title for the content. Example: 'Installation Guide', 'Meeting Notes'"
              },
              user: {
                type: "string",
                description: "Optional user identifier. Example: 'john.doe'"
              },
              metadata: {
                type: "object",
                description: "Optional metadata like tags, categories, etc."
              }
            },
            required: ["repositoryId", "inputType"]
          }
        },
    
        // === KNOWLEDGE BASE INTERACTION ===
        {
          name: "lspace_search_knowledge_base",
          description: "πŸ” SEARCH: Query the knowledge base using natural language. Automatically syncs with remote before searching to ensure latest content. Example: repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb', queryText='What are the testing procedures?'",
          inputSchema: {
            type: "object",
            properties: {
              repositoryId: {
                type: "string",
                description: "The ID of the Lspace repository to query. Use 'lspace_list_repositories' first to get repository IDs."
              },
              queryText: {
                type: "string",
                description: "Natural language query about the knowledge base content. Examples: 'What are the main topics?', 'How do I configure X?', 'Tell me about testing procedures'"
              }
            },
            required: ["repositoryId", "queryText"]
          }
        },
        {
          name: "lspace_browse_knowledge_base",
          description: "πŸ“– BROWSE: Read existing knowledge base files/directories (read-only). Automatically syncs with remote before browsing to ensure latest content. Example: To list files in 'Lspace Official Docs' root, use repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb', operation='list_directory', path='.'",
          inputSchema: {
            type: "object",
            properties: {
              repositoryId: {
                type: "string",
                description: "The ID of the Lspace repository. Use 'lspace_list_repositories' first to get repository IDs."
              },
              operation: {
                type: "string", 
                description: "Operation type: 'list_directory' to see files/folders, 'read_file' to read file contents. Use 'lspace_add_content' for content creation.",
                enum: ["read_file", "list_directory"]
              },
              path: {
                type: "string",
                description: "Path relative to repository root. Use '.' for root directory, 'folder/file.txt' for specific files."
              }
            },
            required: ["repositoryId", "operation", "path"]
          }
        },
    
        // === KNOWLEDGE BASE HISTORY & REVERT ===
        {
          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"]
          }
        },
        {
          name: "lspace_undo_knowledge_base_changes",
          description: "πŸ”„ UNDO: Revert knowledge base changes using human-friendly commands. Can undo file uploads, KB generations, or both. Examples: 'undo changes for test.txt', 'undo last 3 changes', 'remove test.txt completely'",
          inputSchema: {
            type: "object",
            properties: {
              repositoryId: {
                type: "string",
                description: "The ID of the Lspace repository. Use 'lspace_list_repositories' first to get repository IDs."
              },
              filename: {
                type: "string",
                description: "Target a specific file. Example: 'test.txt', 'meeting-notes.md'"
              },
              changeId: {
                type: "string",
                description: "Specific change ID from 'lspace_list_knowledge_base_history'"
              },
              lastNChanges: {
                type: "number",
                description: "Undo the last N changes. Example: 1 for last change, 3 for last 3 changes"
              },
              revertType: {
                type: "string",
                description: "What to revert: 'file_upload' (remove file), 'knowledge_base_generation' (keep file, regenerate KB), 'both' (remove everything)",
                enum: ["file_upload", "knowledge_base_generation", "both"]
              },
              regenerateAfterRevert: {
                type: "boolean",
                description: "For knowledge_base_generation reverts, trigger automatic regeneration (default: false)"
              }
            },
            required: ["repositoryId"]
          }
        }
      ];
    }
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 of behavioral disclosure. It indicates this is a creation/mutation tool ('CREATE: Add content'), which implies it modifies data. However, it lacks details on permissions, error handling, rate limits, or what happens after content is added (e.g., processing time, confirmation). The example helps but doesn't cover behavioral traits comprehensively.

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 efficiently structured with an emoji for visual emphasis, a clear purpose statement, and a practical exampleβ€”all in two sentences. Every element serves a purpose: the first sentence defines the tool's role, and the second provides actionable context. No wasted words or redundancy.

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 the tool's complexity (8 parameters, mutation operation) and lack of annotations or output schema, the description is moderately complete. It covers the primary use case and provides an example, but for a tool that likely triggers backend processing (e.g., 'automatic knowledge base generation'), it should mention expected outcomes, processing behavior, or error scenarios to be fully adequate.

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 already documents all 8 parameters thoroughly. The description adds minimal value beyond the schema by providing a concrete example with parameter values (e.g., repositoryId='b3fcb584-5fd9-4098-83b8-8c5d773d86eb'), but doesn't explain parameter interactions or semantics not already in the schema descriptions. Baseline 3 is appropriate when schema does the heavy lifting.

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 a specific verb ('Add content') and resource ('for automatic knowledge base generation'), explicitly identifying it as the PRIMARY tool for adding ANY content to lspace. It distinguishes itself from siblings by emphasizing its role as the main content addition mechanism, unlike browsing, searching, or listing tools.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: it's the PRIMARY tool for adding ANY content to lspace, with a clear example. It implicitly distinguishes from siblings by focusing on content creation rather than retrieval (e.g., lspace_search_knowledge_base) or management (e.g., lspace_list_repositories).

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