execute_groovy
Run Groovy scripts in SAP Commerce Cloud (Hybris) to automate tasks, query data, or perform system administration through the Hybris scripting console.
Instructions
Execute a Groovy script in the Hybris scripting console
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | Groovy script to execute |
Implementation Reference
- src/hybris-client.ts:404-420 (handler)The primary handler function that executes the provided Groovy script by posting it to the Hybris HAC scripting console endpoint.async executeGroovyScript(script: string): Promise<{ output: string; result: unknown }> { const formData = new URLSearchParams({ script, scriptType: 'groovy', }); return this.hacRequest<{ output: string; result: unknown }>( `${this.hacPrefix}/console/scripting/execute`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: formData, } ); }
- src/index.ts:147-160 (registration)Tool registration in the MCP server's tools list, defining the name, description, and input schema for execute_groovy.{ 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', }, }, required: ['script'], }, },
- src/index.ts:331-333 (handler)Dispatch logic in the main CallToolRequestSchema handler that routes the tool call to the HybrisClient method.case 'execute_groovy': result = await hybrisClient.executeGroovyScript(args?.script as string); break;
- src/index.ts:150-159 (schema)Input schema definition for the execute_groovy tool, specifying the required 'script' parameter.inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'Groovy script to execute', }, }, required: ['script'], },