resyncDocuments
Reprocess documents matching specified filter criteria to update them after schema changes in SourceSync.ai's knowledge management platform.
Instructions
Reprocesses documents that match the specified filter criteria. Useful for updating after schema changes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentIds | No | ||
| filterConfig | Yes | ||
| namespaceId | No | ||
| tenantId | No |
Implementation Reference
- src/index.ts:524-568 (handler)MCP tool registration and handler implementation for 'resyncDocuments'. Creates SourceSyncApiClient instance and calls its resyncDocuments method with prepared filterConfig, handling enum conversions and documentIds addition.server.tool( 'resyncDocuments', 'Reprocesses documents that match the specified filter criteria. Useful for updating after schema changes.', ResyncDocumentsSchema.shape, async (params: any) => { return safeApiCall(async () => { const { namespaceId, documentIds, tenantId, filterConfig } = params // Create a client with the provided parameters const client = createClient({ namespaceId, tenantId }) // Add documentIds to filter if provided and not already in filter if (documentIds && documentIds.length > 0 && !filterConfig.documentIds) { filterConfig.documentIds = documentIds } // Call the resyncDocuments method with properly structured parameters return await client.resyncDocuments({ filterConfig: { ...filterConfig, // Convert string enum values to their SourceSync enum equivalents documentTypes: filterConfig.documentTypes?.map( (type: string) => SourceSyncDocumentType[ type as keyof typeof SourceSyncDocumentType ], ), documentIngestionSources: filterConfig.documentIngestionSources?.map( (source: string) => SourceSyncIngestionSource[ source as keyof typeof SourceSyncIngestionSource ], ), documentIngestionStatuses: filterConfig.documentIngestionStatuses?.map( (status: string) => SourceSyncIngestionStatus[ status as keyof typeof SourceSyncIngestionStatus ], ), }, }) }) }, )
- src/schemas.ts:413-418 (schema)Zod input schema for resyncDocuments tool, defining parameters like namespaceId, documentIds, tenantId, and filterConfig.export const ResyncDocumentsSchema = z.object({ namespaceId: namespaceIdSchema.optional(), documentIds: z.array(z.string()).optional(), tenantId: tenantIdSchema, filterConfig: FilterConfigSchema, })
- src/sourcesync.ts:540-557 (helper)SourceSyncApiClient.resyncDocuments helper method that performs POST request to /v1/documents/resync API endpoint with namespaceId and filterConfig./** * Resync documents */ public async resyncDocuments({ filterConfig, }: Omit< SourceSyncResyncDocumentsRequest, 'namespaceId' >): Promise<SourceSyncResyncDocumentsResponse> { return this.client .url(`/v1/documents/resync`) .json({ namespaceId: this.namespaceId, filterConfig, } satisfies SourceSyncResyncDocumentsRequest) .post() .json<SourceSyncResyncDocumentsResponse>() }
- src/sourcesync.types.ts:649-662 (schema)TypeScript type definitions for SourceSyncResyncDocumentsRequest and SourceSyncResyncDocumentsResponse used by the resyncDocuments implementation.export type SourceSyncResyncDocumentsRequest = { namespaceId: string filterConfig: SourceSyncDocumentFilterConfig } export type SourceSyncResyncDocumentsResponse = SourceSyncApiResponse<{ itemsQueued: number itemsSkipped: number documents: { id: string status: 'QUEUED_FOR_RESYNC' | 'NOT_ELIGIBLE_FOR_RESYNC' error: string | null }[] }>