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[]
    }>
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action is 'permanently deletes,' implying irreversibility and destructive behavior, which is critical. However, it lacks details on permissions required, rate limits, error handling, or what happens to associated data, leaving significant gaps for a destructive operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence that front-loads the key action ('permanently deletes') and resource ('documents'), with no wasted words. It efficiently conveys the core purpose without redundancy or unnecessary elaboration, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (destructive operation with 4 parameters, nested objects, and no output schema) and lack of annotations, the description is insufficient. It doesn't explain parameter usage, return values, error conditions, or safety considerations, making it incomplete for effective agent invocation in this context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning parameters are undocumented in the schema. The description only vaguely references 'filter criteria' without explaining any of the 4 parameters (e.g., namespaceId, documentIds, tenantId, filterConfig) or their purposes. It fails to compensate for the schema's lack of documentation, leaving parameters semantically unclear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('permanently deletes') and resource ('documents'), specifying it operates based on filter criteria. It distinguishes from siblings like 'updateDocuments' or 'fetchDocuments' by emphasizing deletion. However, it doesn't explicitly differentiate from 'deleteNamespace' or other deletion tools, keeping it at 4 rather than 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'updateDocuments' for modifications or 'fetchDocuments' for retrieval. It mentions filter criteria but doesn't specify prerequisites, exclusions, or recommend other tools for related tasks, leaving the agent with minimal context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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