Skip to main content
Glama

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
NameRequiredDescriptionDefault
namespaceIdNo
fileYes
metadataNo
chunkConfigNoOptional Chunk config. When not passed, default chunk config will be used.
tenantIdNo

Implementation Reference

  • 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, }) }) }, )
  • 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, })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pbteja1998/sourcesyncai-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server