ingestFile
Add files to a knowledge base namespace with automatic parsing and configurable chunking for content organization.
Instructions
Ingests a file into the namespace. Supports various file formats with automatic parsing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespaceId | No | ||
| file | Yes | ||
| metadata | No | ||
| chunkConfig | No | Optional Chunk config. When not passed, default chunk config will be used. | |
| tenantId | No |
Implementation Reference
- src/sourcesync.ts:346-363 (handler)Core handler implementation of ingestFile in SourceSyncApiClient: sends formData POST request to /v1/ingest/file API endpoint with file, metadata, and default chunk config.public async ingestFile({ file, metadata, }: Omit< SourceSyncIngestFileRequest, 'namespaceId' >): Promise<SourceSyncIngestResponse> { return this.client .url('/v1/ingest/file') .formData({ namespaceId: this.namespaceId, file, metadata: JSON.stringify(metadata), chunkConfig: JSON.stringify(SourceSyncApiClient.CHUNK_CONFIG), }) .post() .json<SourceSyncIngestResponse>() }
- src/index.ts:228-248 (registration)MCP server.tool registration for 'ingestFile', including description, input schema, and thin wrapper handler that creates SourceSync client and delegates to client.ingestFile.// Add ingestFile tool server.tool( 'ingestFile', 'Ingests a file into the namespace. Supports various file formats with automatic parsing.', IngestFileSchema.shape, async (params) => { return safeApiCall(async () => { const { namespaceId, tenantId, file, metadata, chunkConfig } = params // Create a client with the provided parameters const client = createClient({ namespaceId, tenantId }) // Direct passthrough to the API return await client.ingestFile({ file: file as unknown as File, // Type cast to File as required by the client metadata, chunkConfig, }) }) }, )
- src/schemas.ts:194-200 (schema)Zod schema defining input parameters for ingestFile tool: namespaceId (opt), file (Blob), metadata (opt), chunkConfig (opt), tenantId.export const IngestFileSchema = z.object({ namespaceId: namespaceIdSchema.optional(), file: z.instanceof(Blob), metadata: z.record(z.union([z.string(), z.array(z.string())])).optional(), chunkConfig: chunkConfigSchema.optional(), tenantId: tenantIdSchema, })