Skip to main content
Glama

trigger_cronjob

Execute scheduled tasks in SAP Commerce Cloud by triggering cron jobs using specific job codes to automate system processes.

Instructions

Trigger a cron job to run

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cronJobCodeYesCode of the cron job to trigger

Implementation Reference

  • The handler method in HybrisClient that executes a Groovy script to trigger a CronJob by code.
      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'}`,
        };
      }
  • src/index.ts:266-279 (registration)
    Definition of the trigger_cronjob tool, including input schema and description.
    {
      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'],
      },
    },
  • Implementation of the tool call handler for trigger_cronjob in the main index.ts file.
    case 'trigger_cronjob':
      result = await hybrisClient.triggerCronJob(
        validateString(args, 'cronJobCode', true)
      );
      break;

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

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