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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| fileStorageConfig | Yes | ||
| vectorStorageConfig | Yes | ||
| embeddingModelConfig | Yes | ||
| webScraperConfig | No | ||
| tenantId | No |
Implementation Reference
- src/index.ts:132-141 (handler)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) }) },
- src/schemas.ts:112-119 (schema)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) }) }, )
- src/sourcesync.ts:151-169 (helper)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>() }