Skip to main content
Glama
Emenowicz

Hybris MCP Server

by Emenowicz

execute_groovy

Execute Groovy scripts in SAP Commerce Cloud to automate tasks, manage data, and perform system administration 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

  • MCP tool handler for 'execute_groovy': validates input arguments and delegates execution to HybrisClient.executeGroovyScript.
    case 'execute_groovy':
      result = await hybrisClient.executeGroovyScript(
        validateString(args, 'script', true),
        validateBoolean(args, 'commit', false)
      );
      break;
  • Input schema for the 'execute_groovy' tool defining the expected parameters: required 'script' string and optional 'commit' boolean.
    inputSchema: {
      type: 'object',
      properties: {
        script: {
          type: 'string',
          description: 'Groovy script to execute',
        },
        commit: {
          type: 'boolean',
          description: 'Whether to commit database changes (default: false)',
        },
      },
      required: ['script'],
    },
  • src/index.ts:212-229 (registration)
    Registration of the 'execute_groovy' tool in the MCP tools list, including name, description, and input schema.
    {
      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)',
          },
        },
        required: ['script'],
      },
    },
  • Core helper method implementing Groovy script execution by posting to Hybris HAC scripting endpoint and mapping the response.
    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,
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions executing a script but fails to detail critical traits: whether this is a read/write operation (implied by the 'commit' parameter but not stated), potential risks (e.g., database modifications), authentication needs, or output format (e.g., script results or errors). This is inadequate for a tool that could have significant side effects.

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 front-loads the core purpose without unnecessary words. Every part ('Execute a Groovy script in the Hybris scripting console') directly contributes to understanding the tool's function, making it highly concise and well-structured.

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 executing scripts (potentially involving database changes) and the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., script output, success/failure), error handling, or safety considerations, leaving gaps that could hinder effective agent use.

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%, with both parameters ('script' and 'commit') well-documented in the schema. The description adds no additional meaning beyond implying script execution in a Hybris context, which is already covered by the tool's name and description. Thus, it meets the baseline for high schema coverage without compensating value.

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 resource ('Groovy script in the Hybris scripting console'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'flexible_search' or 'trigger_cronjob' which might also involve script execution or console operations, leaving room for ambiguity in tool selection.

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 offers no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing access to the Hybris console), exclusions (e.g., not for simple queries), or compare it to siblings like 'flexible_search' for data retrieval or 'import_impex' for data manipulation, leaving the agent without context for decision-making.

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