ingestText
Adds text content to a knowledge base with configurable metadata and chunking options for organized content 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 name, description, schema, and handler function.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)The handler function passed to MCP server for executing the ingestText tool logic, delegating to SourceSync client.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 defining the input parameters for the ingestText tool.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 (handler)Core implementation of ingestText in SourceSyncApiClient, making the POST request to the SourceSync API /v1/ingest/text endpoint.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>() }