Skip to main content
Glama
Emenowicz

Hybris MCP Server

by Emenowicz

trigger_catalog_sync

Sync catalog data between versions in SAP Commerce Cloud. Specify catalog ID, source version, and target version to update product information.

Instructions

Trigger a catalog synchronization between versions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
catalogIdYesCatalog ID to sync
sourceVersionYesSource catalog version (e.g., "Staged")
targetVersionYesTarget catalog version (e.g., "Online")

Implementation Reference

  • The core handler function for trigger_catalog_sync. It constructs and executes a Groovy script via HAC to find the appropriate CatalogVersionSyncJob, create a CatalogVersionSyncCronJobModel, save it, and perform the cron job to synchronize the catalog versions.
      async triggerCatalogSync(
        catalogId: string,
        sourceVersion: string,
        targetVersion: string
      ): Promise<{ success: boolean; message: string }> {
        // Use Groovy script to trigger catalog sync by creating a properly configured CronJob
        const escapedCatalogId = this.escapeGroovyString(catalogId);
        const escapedSource = this.escapeGroovyString(sourceVersion);
        const escapedTarget = this.escapeGroovyString(targetVersion);
        const script = `
    import de.hybris.platform.catalog.model.synchronization.CatalogVersionSyncCronJobModel
    import de.hybris.platform.cronjob.enums.JobLogLevel
    
    try {
        def catalogVersionService = spring.getBean("catalogVersionService")
        def modelService = spring.getBean("modelService")
        def cronJobService = spring.getBean("cronJobService")
        def flexibleSearchService = spring.getBean("flexibleSearchService")
    
        def sourceCatalogVersion = catalogVersionService.getCatalogVersion("${escapedCatalogId}", "${escapedSource}")
        def targetCatalogVersion = catalogVersionService.getCatalogVersion("${escapedCatalogId}", "${escapedTarget}")
    
        if (sourceCatalogVersion == null) {
            println "ERROR: Source catalog version not found: ${escapedCatalogId}:${escapedSource}"
            return "SOURCE_NOT_FOUND"
        }
        if (targetCatalogVersion == null) {
            println "ERROR: Target catalog version not found: ${escapedCatalogId}:${escapedTarget}"
            return "TARGET_NOT_FOUND"
        }
    
        // Find sync job using flexible search
        def query = "SELECT {pk} FROM {CatalogVersionSyncJob} WHERE {sourceVersion} = ?source AND {targetVersion} = ?target"
        def params = [source: sourceCatalogVersion, target: targetCatalogVersion]
        def searchResult = flexibleSearchService.search(query, params)
    
        if (searchResult.result.isEmpty()) {
            println "ERROR: No sync job found for ${escapedCatalogId} ${escapedSource} -> ${escapedTarget}"
            println "Available sync jobs:"
            def allJobs = flexibleSearchService.search("SELECT {pk}, {code} FROM {CatalogVersionSyncJob}").result
            allJobs.each { job -> println "  - " + job.code }
            return "SYNC_JOB_NOT_FOUND"
        }
    
        def syncJob = searchResult.result[0]
        println "Found sync job: " + syncJob.code
    
        // Create a new CronJob with all mandatory attributes
        def syncCronJob = modelService.create(CatalogVersionSyncCronJobModel.class)
        syncCronJob.setJob(syncJob)
        syncCronJob.setCode("mcp_sync_" + System.currentTimeMillis())
    
        // Set all mandatory attributes
        syncCronJob.setCreateSavedValues(false)
        syncCronJob.setForceUpdate(false)
        syncCronJob.setLogToDatabase(false)
        syncCronJob.setLogToFile(false)
        syncCronJob.setLogLevelDatabase(JobLogLevel.WARNING)
        syncCronJob.setLogLevelFile(JobLogLevel.WARNING)
    
        modelService.save(syncCronJob)
        println "Created sync cronjob: " + syncCronJob.code
    
        // Trigger the cronjob
        cronJobService.performCronJob(syncCronJob, true)
    
        println "SUCCESS: Catalog sync triggered: ${escapedCatalogId} ${escapedSource} -> ${escapedTarget}"
        return "SUCCESS"
    } catch (Exception e) {
        println "ERROR: " + e.getMessage()
        e.printStackTrace()
        return "ERROR: " + e.getMessage()
    }
    `;
        const result = await this.executeGroovyScript(script);
        const output = result.output || '';
        const execResult = String(result.result || '');
        const success = output.includes('SUCCESS:') || execResult === 'SUCCESS';
        const errorMatch = output.match(/ERROR: (.+)/);
        return {
          success,
          message: success
            ? `Catalog sync triggered: ${catalogId} ${sourceVersion} -> ${targetVersion}`
            : errorMatch ? errorMatch[1] : `Failed to sync: ${output || execResult || 'Unknown error'}`,
        };
      }
  • Input schema definition for the trigger_catalog_sync tool, defining the required parameters and their descriptions for MCP tool validation.
    name: 'trigger_catalog_sync',
    description: 'Trigger a catalog synchronization between versions',
    inputSchema: {
      type: 'object',
      properties: {
        catalogId: {
          type: 'string',
          description: 'Catalog ID to sync',
        },
        sourceVersion: {
          type: 'string',
          description: 'Source catalog version (e.g., "Staged")',
        },
        targetVersion: {
          type: 'string',
          description: 'Target catalog version (e.g., "Online")',
        },
      },
      required: ['catalogId', 'sourceVersion', 'targetVersion'],
    },
  • src/index.ts:454-460 (registration)
    Registration and dispatching logic in the MCP server request handler switch statement, which maps the tool name to the HybrisClient.triggerCatalogSync method call with input validation.
    case 'trigger_catalog_sync':
      result = await hybrisClient.triggerCatalogSync(
        validateString(args, 'catalogId', true),
        validateString(args, 'sourceVersion', true),
        validateString(args, 'targetVersion', true)
      );
      break;
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Trigger a catalog synchronization', implying a write or update operation, but does not specify if this is destructive, requires authentication, has side effects, or involves rate limits. The lack of details on what happens during synchronization (e.g., overwriting data, merging changes) leaves significant gaps in understanding the tool's behavior, making it inadequate for safe invocation.

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

Conciseness4/5

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

The description is a single, efficient sentence: 'Trigger a catalog synchronization between versions'. It is front-loaded with the core action and resource, with no wasted words. However, it could be slightly more informative by including key details like the outcome or constraints, but as is, it achieves conciseness without being overly sparse.

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 complexity of a synchronization tool with no annotations and no output schema, the description is incomplete. It does not explain what synchronization entails, potential impacts, return values, or error conditions. For a tool that likely modifies data between versions, this lack of context makes it insufficient for safe and effective use, especially compared to sibling tools with clearer purposes.

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

Parameters3/5

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

The input schema has 100% description coverage, with clear documentation for all three parameters (catalogId, sourceVersion, targetVersion). The description does not add any meaning beyond the schema, such as explaining parameter interactions or providing examples beyond the schema's descriptions (e.g., 'Staged' and 'Online' for versions). Since the schema handles the heavy lifting, the baseline score of 3 is appropriate, as the description offers no additional parameter insights.

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

Purpose3/5

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

The description states the tool's purpose as 'Trigger a catalog synchronization between versions', which includes a verb ('Trigger') and resource ('catalog synchronization'), making it clear what action is performed. However, it lacks specificity about what synchronization entails (e.g., data copying, metadata updates) and does not distinguish it from sibling tools like 'import_impex' or 'export_impex', which might involve similar data operations. This results in a vague but understandable purpose.

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. It does not mention prerequisites, such as needing specific catalog states, or compare it to sibling tools like 'import_impex' for data imports or 'trigger_cronjob' for scheduled tasks. Without any context on usage scenarios or exclusions, the agent must infer when this tool is appropriate, leading to minimal guidance.

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/Emenowicz/hybris-mcp'

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