Skip to main content
Glama
scmdr

SourceSync.ai MCP Server

by scmdr

resyncDocuments

Reprocess documents matching specific criteria to update them after schema changes or configuration adjustments.

Instructions

Reprocesses documents that match the specified filter criteria. Useful for updating after schema changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namespaceIdNo
documentIdsNo
tenantIdNo
filterConfigYes

Implementation Reference

  • src/index.ts:524-568 (registration)
    Registers the MCP tool named 'resyncDocuments' with input schema and handler function that processes parameters and calls the SourceSync client's resyncDocuments method.
    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
                    ],
                ),
            },
          })
        })
      },
    )
  • The core implementation of resyncDocuments in the SourceSyncApiClient class, which sends a POST request to /v1/documents/resync with the filterConfig.
    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>()
    }
  • Zod schema definition for the input parameters of the resyncDocuments tool.
    export const ResyncDocumentsSchema = z.object({
      namespaceId: namespaceIdSchema.optional(),
      documentIds: z.array(z.string()).optional(),
      tenantId: tenantIdSchema,
      filterConfig: FilterConfigSchema,
    })
  • TypeScript type definitions for the SourceSyncResyncDocumentsRequest and SourceSyncResyncDocumentsResponse used by the client.
    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
      }[]
    }>
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'reprocesses' and 'updating,' implying a mutation operation, but doesn't disclose critical behavioral traits like whether this is destructive, requires specific permissions, has rate limits, or what 'reprocess' entails (e.g., re-indexing, re-parsing). The description adds minimal context beyond the basic action.

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 appropriately sized with two concise sentences that are front-loaded: the first states the core action, and the second adds context. Every sentence earns its place by clarifying purpose and usage without redundancy or fluff.

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 (4 parameters with nested objects, no annotations, no output schema), the description is inadequate. It doesn't explain the mutation behavior, parameter interactions, or expected outcomes. For a tool that likely involves significant processing, more detail on effects, prerequisites, and limitations is needed to be complete.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'filter criteria' but doesn't explain the four parameters (namespaceId, documentIds, tenantId, filterConfig) or their relationships (e.g., filterConfig is required). No details are provided on how filtering works or what 'reprocess' means for the parameters. The description adds little semantic value beyond the schema.

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 tool's purpose with 'Reprocesses documents that match the specified filter criteria,' providing a specific verb ('reprocesses') and resource ('documents'). It distinguishes itself from siblings like 'updateDocuments' by focusing on reprocessing rather than content updates. However, it doesn't explicitly differentiate from 'ingest' tools that also process documents.

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

Usage Guidelines3/5

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

The description provides some usage context with 'Useful for updating after schema changes,' which implies when to use it. However, it doesn't specify when NOT to use it or mention alternatives among siblings like 'updateDocuments' for content changes or 'ingest' tools for initial processing. The guidance is helpful but incomplete.

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