ingestText
Process and store raw text content within a specified namespace, enabling optional metadata inclusion and customizable text chunking for efficient data organization and retrieval.
Instructions
Ingests raw text content into the namespace. Supports optional metadata and chunk configuration.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ingestConfig | Yes | ||
| namespaceId | No | ||
| tenantId | No |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"ingestConfig": {
"additionalProperties": false,
"properties": {
"chunkConfig": {
"additionalProperties": false,
"description": "Optional Chunk config. When not passed, default chunk config will be used.",
"properties": {
"chunkOverlap": {
"type": "number"
},
"chunkSize": {
"type": "number"
}
},
"required": [
"chunkSize",
"chunkOverlap"
],
"type": "object"
},
"config": {
"additionalProperties": false,
"properties": {
"metadata": {
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
]
},
"type": "object"
},
"name": {
"type": "string"
},
"text": {
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
},
"source": {
"const": "TEXT",
"type": "string"
}
},
"required": [
"source",
"config"
],
"type": "object"
},
"namespaceId": {
"type": "string"
},
"tenantId": {
"type": "string"
}
},
"required": [
"ingestConfig"
],
"type": "object"
}
Implementation Reference
- src/schemas.ts:150-162 (schema)Zod schema for 'ingestText' tool input validation, defining namespaceId, ingestConfig (with text source), chunkConfig, and 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/index.ts:209-226 (registration)MCP server.tool registration for 'ingestText', providing name, description, input schema, and inline 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)Handler function executed when 'ingestText' tool is called; wraps safeApiCall, creates SourceSync client, and invokes client.ingestText.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/sourcesync.ts:324-341 (helper)SourceSyncApiClient.ingestText method, which performs the actual API POST to /v1/ingest/text with namespaceId and ingestConfig, adding 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>() }