Skip to main content
Glama
scmdr

SourceSync.ai MCP Server

by scmdr

deleteDocuments

Remove documents from SourceSync.ai's knowledge management platform by specifying filter criteria such as document type, source, or status.

Instructions

Permanently deletes documents that match the specified filter criteria.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceIdNo
documentIdsNo
tenantIdNo
filterConfigYes

Implementation Reference

  • Primary MCP tool handler for 'deleteDocuments'. Extracts parameters, creates SourceSync client, merges documentIds into filterConfig, converts string enums to typed enums, and invokes the underlying deleteDocuments API method.
    server.tool( 'deleteDocuments', 'Permanently deletes documents that match the specified filter criteria.', DeleteDocumentsSchema.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 deleteDocuments method with properly structured parameters return await client.deleteDocuments({ 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 ], ), }, }) }) }, )
  • Zod schema defining the input parameters for the deleteDocuments tool, including optional namespaceId, documentIds, tenantId, and filterConfig.
    export const DeleteDocumentsSchema = z.object({ namespaceId: namespaceIdSchema.optional(), documentIds: z.array(z.string()).optional(), tenantId: tenantIdSchema, filterConfig: FilterConfigSchema, })
  • SourceSyncApiClient.deleteDocuments method: sends HTTP DELETE to /v1/documents with namespaceId and filterConfig payload to delete matching documents.
    public async deleteDocuments({ filterConfig, }: Omit< SourceSyncDeleteDocumentsRequest, 'namespaceId' >): Promise<SourceSyncDeleteDocumentsResponse> { return this.client .url(`/v1/documents`) .json({ namespaceId: this.namespaceId, filterConfig, } satisfies SourceSyncDeleteDocumentsRequest) .delete() .json<SourceSyncDeleteDocumentsResponse>() }
  • src/index.ts:478-522 (registration)
    MCP server.tool registration for the 'deleteDocuments' tool, specifying name, description, input schema, and handler function.
    server.tool( 'deleteDocuments', 'Permanently deletes documents that match the specified filter criteria.', DeleteDocumentsSchema.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 deleteDocuments method with properly structured parameters return await client.deleteDocuments({ 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 ], ), }, }) }) }, )
  • TypeScript type definitions for SourceSyncDeleteDocumentsRequest and Response used in the API client.
    export type SourceSyncDeleteDocumentsRequest = { namespaceId: string filterConfig: SourceSyncDocumentFilterConfig } export type SourceSyncDeleteDocumentsResponse = SourceSyncApiResponse<{ itemsDeleted: number documents: SourceSyncFaunaRef[] }>

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/scmdr/sourcesyncai-mcp'

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