Skip to main content
Glama
Emenowicz

Hybris MCP Server

by Emenowicz

import_impex

Import data into SAP Commerce Cloud using ImpEx format to manage products, orders, and system configurations through structured content.

Instructions

Import data using ImpEx format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
impexContentYesImpEx content to import

Implementation Reference

  • Core implementation of the importImpex tool. Escapes the provided impexContent, generates and executes a Groovy script that uses Hybris ImportService to perform the import, parses the output to determine success and extract errors.
      async importImpex(impexContent: string): Promise<ImpexResult> {
        // Use Groovy script for ImpEx import with ImportService
        const escapedContent = this.escapeGroovyString(impexContent);
    
        const script = `
    import de.hybris.platform.servicelayer.impex.ImportService
    import de.hybris.platform.servicelayer.impex.ImportConfig
    import de.hybris.platform.servicelayer.impex.impl.StreamBasedImpExResource
    
    try {
        def impexContent = "${escapedContent}"
        def importService = spring.getBean("importService")
    
        def config = new ImportConfig()
        def resource = new StreamBasedImpExResource(
            new ByteArrayInputStream(impexContent.getBytes("UTF-8")),
            "UTF-8"
        )
        config.setScript(resource)
        config.setEnableCodeExecution(true)
    
        def importResult = importService.importData(config)
    
        if (importResult.hasUnresolvedLines()) {
            println "WARNING: Import completed with unresolved lines"
            importResult.unresolvedLines.allLines.each { line ->
                println "  Unresolved: " + line
            }
        }
    
        if (importResult.isError()) {
            println "ERROR: Import failed"
            if (importResult.unresolvedLines?.allLines) {
                importResult.unresolvedLines.allLines.each { line ->
                    println "  Error: " + line
                }
            }
            return "ERROR"
        }
    
        println "SUCCESS: ImpEx import completed"
        return "SUCCESS"
    } catch (Exception e) {
        println "ERROR: " + e.getMessage()
        e.printStackTrace()
        return "ERROR: " + e.getMessage()
    }
    `;
        const result = await this.executeGroovyScript(script, true); // commit=true for imports
        const output = result.output || '';
        const execResult = String(result.result || '');
        const success = output.includes('SUCCESS:') || execResult === 'SUCCESS';
        const errors: string[] = [];
    
        // Extract unresolved lines as errors
        const unresolvedMatch = output.match(/Unresolved: (.+)/g);
        if (unresolvedMatch) {
          errors.push(...unresolvedMatch);
        }
    
        const errorMatch = output.match(/ERROR: (.+)/);
        if (errorMatch) {
          errors.push(errorMatch[1]);
        }
    
        return {
          success,
          message: output || execResult,
          errors: errors.length > 0 ? errors : undefined,
        };
      }
  • MCP server request handler for 'import_impex' tool call. Validates the input arguments and delegates to the HybrisClient.importImpex method.
    case 'import_impex':
      result = await hybrisClient.importImpex(
        validateString(args, 'impexContent', true)
      );
      break;
  • Input schema for the import_impex tool, requiring a single 'impexContent' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        impexContent: {
          type: 'string',
          description: 'ImpEx content to import',
        },
      },
      required: ['impexContent'],
  • src/index.ts:230-242 (registration)
    Registration of the 'import_impex' tool in the MCP tools list, including name, description, and input schema.
    {
      name: 'import_impex',
      description: 'Import data using ImpEx format',
      inputSchema: {
        type: 'object',
        properties: {
          impexContent: {
            type: 'string',
            description: 'ImpEx content to import',
          },
        },
        required: ['impexContent'],
      },
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this is a destructive operation, requires specific permissions, has rate limits, or what happens on success/failure, which is inadequate for a data import tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words, making it appropriately concise. However, it could be more front-loaded with critical details, but its brevity is a strength given the limited information provided.

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 data import tool with no annotations and no output schema, the description is incomplete. It lacks context on what data is imported, behavioral traits, or return values, failing to compensate for the missing structured information.

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 input schema fully documents the 'impexContent' parameter. The description adds no additional meaning beyond implying the parameter is ImpEx content, meeting the baseline for high schema coverage without extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the action ('import data') and format ('ImpEx format'), which provides a basic purpose. However, it lacks specificity about what data is imported (e.g., products, categories) and doesn't distinguish from sibling tools like 'export_impex', making it vague in context.

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. It doesn't mention prerequisites, such as needing ImpEx content, or compare to siblings like 'flexible_search' or 'trigger_catalog_sync' for data operations, leaving usage unclear.

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