Skip to main content
Glama

execute_groovy

Execute Groovy scripts in SAP Commerce Cloud to automate tasks, manage data, and configure system settings through the Hybris scripting console.

Instructions

Execute a Groovy script in the Hybris scripting console

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesGroovy script to execute
commitNoWhether to commit database changes (default: false)

Implementation Reference

  • The core implementation of the Groovy script execution logic using the Hybris HAC API.
    async executeGroovyScript(script: string, commit = false): Promise<{ output: string; result: unknown }> {
      const formData = new URLSearchParams({
        script,
        scriptType: 'groovy',
        commit: commit.toString(),
      });
    
      const response = await this.hacRequest<{
        outputText?: string;
        executionResult?: unknown;
        stacktraceText?: string;
      }>(
        `${this.hacPrefix}/console/scripting/execute`,
        {
          method: 'POST',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
          },
          body: formData,
        }
      );
    
      // Map HAC response fields to our expected format
      return {
        output: response.outputText || '',
        result: response.executionResult,
      };
    }
    
    async importImpex(impexContent: string): Promise<ImpexResult> {
      // Use Groovy script for ImpEx import with ImportService
  • src/index.ts:212-225 (registration)
    Tool definition for 'execute_groovy' registered in the MCP tool list.
    {
      name: 'execute_groovy',
      description: 'Execute a Groovy script in the Hybris scripting console',
      inputSchema: {
        type: 'object',
        properties: {
          script: {
            type: 'string',
            description: 'Groovy script to execute',
          },
          commit: {
            type: 'boolean',
            description: 'Whether to commit database changes (default: false)',
          },
  • The tool execution handler that processes requests by calling the hybrisClient.
    case 'execute_groovy':
      result = await hybrisClient.executeGroovyScript(
        validateString(args, 'script', true),
        validateBoolean(args, 'commit', false)
      );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions execution but doesn't cover critical aspects like: whether this requires admin permissions, potential side effects on the Hybris system, timeout or resource limits, or what happens when 'commit' is true versus false. The description is minimal and leaves significant behavioral questions unanswered.

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, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a tool with two parameters and clearly front-loaded with the core functionality.

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?

For a tool that executes arbitrary Groovy scripts in a production system with database commit capabilities, the description is inadequate. With no annotations, no output schema, and a potentially dangerous operation, the description should address safety considerations, permission requirements, and expected output format. The current description leaves too many critical questions unanswered.

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?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it doesn't explain script constraints, provide Groovy examples, or clarify the implications of the commit parameter. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('Execute') and target ('Groovy script in the Hybris scripting console'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'clear_cache' or 'export_impex', but the specificity of executing Groovy scripts in Hybris provides inherent distinction from most siblings.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, typical use cases, or when other tools might be more appropriate (e.g., using 'flexible_search' for queries instead of custom Groovy scripts).

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

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