ingestText
Adds text content to a knowledge base with configurable metadata and chunking options for structured data management.
Instructions
Ingests raw text content into the namespace. Supports optional metadata and chunk configuration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespaceId | No | ||
| ingestConfig | Yes | ||
| tenantId | No |
Implementation Reference
- src/index.ts:209-226 (registration)MCP server.tool registration for the 'ingestText' tool, including description, input schema reference, and inline handler function that creates a SourceSync client and delegates to its ingestText method.server.tool( 'ingestText', 'Ingests raw text content into the namespace. Supports optional metadata and chunk configuration.', ingestTextSchema.shape, async (params: IngestTextParams) => { return safeApiCall(async () => { const { namespaceId, tenantId, ingestConfig } = params // Create a client with the provided parameters const client = createClient({ namespaceId, tenantId }) // Direct passthrough to the API return await client.ingestText({ ingestConfig, }) }) }, )
- src/index.ts:213-225 (handler)Handler function for the ingestText MCP tool. Extracts parameters, creates SourceSyncApiClient instance, and calls its ingestText method with the provided ingestConfig, wrapped in safeApiCall for error handling.async (params: IngestTextParams) => { return safeApiCall(async () => { const { namespaceId, tenantId, ingestConfig } = params // Create a client with the provided parameters const client = createClient({ namespaceId, tenantId }) // Direct passthrough to the API return await client.ingestText({ ingestConfig, }) }) },
- src/schemas.ts:150-162 (schema)Zod schema (ingestTextSchema) defining the input parameters for the ingestText tool, including optional namespaceId, required ingestConfig with text source and config, optional chunkConfig, and optional tenantId.export const ingestTextSchema = z.object({ namespaceId: namespaceIdSchema.optional(), ingestConfig: z.object({ source: z.literal(SourceSyncIngestionSource.TEXT), config: z.object({ name: z.string().optional(), text: z.string(), metadata: z.record(z.union([z.string(), z.array(z.string())])).optional(), }), chunkConfig: chunkConfigSchema.optional(), }), tenantId: tenantIdSchema, })
- src/sourcesync.ts:324-341 (helper)SourceSyncApiClient.ingestText method: the core implementation that sends a POST request to the SourceSync API endpoint '/v1/ingest/text' with namespaceId and ingestConfig (merging default chunkConfig).public async ingestText({ ingestConfig, }: Omit< SourceSyncIngestTextRequest, 'namespaceId' >): Promise<SourceSyncIngestResponse> { return this.client .url('/v1/ingest/text') .json({ namespaceId: this.namespaceId, ingestConfig: { ...ingestConfig, chunkConfig: SourceSyncApiClient.CHUNK_CONFIG, }, } satisfies SourceSyncIngestTextRequest) .post() .json<SourceSyncIngestResponse>() }