Skip to main content
Glama

createNamespace

Creates a new namespace in SourceSync.ai's knowledge management platform by configuring file storage, vector storage, and embedding models for organizing and searching content.

Instructions

Creates a new namespace with the provided configuration. Requires a name, file storage configuration, vector storage configuration, and embedding model configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
fileStorageConfigYes
vectorStorageConfigYes
embeddingModelConfigYes
webScraperConfigNo
tenantIdNo

Implementation Reference

  • MCP tool handler function for 'createNamespace'. Extracts tenantId, creates a SourceSync client, and delegates to client.createNamespace, wrapped in safeApiCall for error handling.
    async (params: CreateNamespaceParams) => {
      return safeApiCall(async () => {
        const { tenantId, ...createParams } = params
    
        // Create a client with the provided API key
        const client = createClient({ tenantId })
    
        return await client.createNamespace(createParams)
      })
    },
  • Zod schema defining the input parameters (name, storage configs, etc.) for the createNamespace tool, used for validation in MCP.
    export const createNamespaceSchema = z.object({
      name: z.string(),
      fileStorageConfig: fileStorageConfigSchema,
      vectorStorageConfig: vectorStorageConfigSchema,
      embeddingModelConfig: embeddingModelConfigSchema,
      webScraperConfig: webScraperConfigSchema.optional(),
      tenantId: tenantIdSchema,
    })
  • src/index.ts:128-142 (registration)
    MCP server.tool call registering the 'createNamespace' tool, specifying name, description, input schema shape, and inline handler function.
    server.tool(
      'createNamespace',
      'Creates a new namespace with the provided configuration. Requires a name, file storage configuration, vector storage configuration, and embedding model configuration.',
      createNamespaceSchema.shape,
      async (params: CreateNamespaceParams) => {
        return safeApiCall(async () => {
          const { tenantId, ...createParams } = params
    
          // Create a client with the provided API key
          const client = createClient({ tenantId })
    
          return await client.createNamespace(createParams)
        })
      },
    )
  • SourceSyncApiClient helper method implementing the core logic: POST JSON request to '/v1/namespaces' endpoint to create a new namespace.
    public async createNamespace({
      name,
      fileStorageConfig,
      vectorStorageConfig,
      embeddingModelConfig,
      webScraperConfig,
    }: SourceSyncCreateNamespaceRequest): Promise<SourceSyncCreateNamespaceResponse> {
      return this.client
        .url('/v1/namespaces')
        .json({
          name,
          fileStorageConfig,
          vectorStorageConfig,
          embeddingModelConfig,
          webScraperConfig,
        } satisfies SourceSyncCreateNamespaceRequest)
        .post()
        .json<SourceSyncCreateNamespaceResponse>()
    }

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/pbteja1998/sourcesyncai-mcp'

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