Skip to main content
Glama

trigger_cronjob

Execute scheduled tasks in SAP Commerce Cloud by triggering cron jobs with specific codes for system administration and automation.

Instructions

Trigger a cron job to run

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cronJobCodeYesCode of the cron job to trigger

Implementation Reference

  • The MCP tool handler for 'trigger_cronjob': validates the input argument 'cronJobCode' and delegates execution to the HybrisClient's triggerCronJob method.
    case 'trigger_cronjob': result = await hybrisClient.triggerCronJob( validateString(args, 'cronJobCode', true) ); break;
  • Input schema definition for the 'trigger_cronjob' tool, specifying the required 'cronJobCode' string parameter.
    inputSchema: { type: 'object', properties: { cronJobCode: { type: 'string', description: 'Code of the cron job to trigger', }, }, required: ['cronJobCode'], },
  • src/index.ts:266-279 (registration)
    Registration of the 'trigger_cronjob' tool in the MCP tools array.
    { name: 'trigger_cronjob', description: 'Trigger a cron job to run', inputSchema: { type: 'object', properties: { cronJobCode: { type: 'string', description: 'Code of the cron job to trigger', }, }, required: ['cronJobCode'], }, },
  • HybrisClient helper method that implements the core logic for triggering a cron job using a Groovy script executed via the HAC scripting console, leveraging CronJobService to perform the job.
    async triggerCronJob(cronJobCode: string): Promise<{ success: boolean; message: string }> { // Use Groovy script to trigger cron job const escapedCode = this.escapeGroovyString(cronJobCode); const script = ` import de.hybris.platform.servicelayer.cronjob.CronJobService def cronJobService = spring.getBean("cronJobService") def cronJob = cronJobService.getCronJob("${escapedCode}") if (cronJob == null) { println "CronJob not found: ${escapedCode}" return "NOT_FOUND" } cronJobService.performCronJob(cronJob, true) println "CronJob triggered: ${escapedCode}" return "SUCCESS" `; const result = await this.executeGroovyScript(script); const output = result.output || ''; const execResult = String(result.result || ''); const success = output.includes('triggered') || execResult === 'SUCCESS'; return { success, message: success ? `CronJob ${cronJobCode} triggered` : `Failed to trigger ${cronJobCode}: ${output || execResult || 'Unknown error'}`, }; }

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