Getting started

An overview of the Domain-Specific Language (DSL) used for defining rules and their respective conditions and actions within the Commerce Layer Rules Engine

The Commerce Layer Rules Engine is a Domain-Specific Language (DSL) used for defining rules that can support from the simplest to the most complex logic. The rules can be evaluated against a specific payload to check if the requested conditions are met so that the respective actions will be applied.

Core API integration

The Rules Engine is currently integrated with Commerce Layer Core API to enable the creation and management of a super-flexible promotional system that covers a wide set of use cases.

The Rules Engine integration is currently enabled for a subset of resources: at the moment promotions and price lists are available (more to come).

Most of the examples and JSON snippets used in the following sections to illustrate how the Rules Engine works refer to order rules. You can easily use them as a reference to create price rules or other rules related to any possible future Rule Engine integrations.

LLM-friendly text files

Large Language Models are becoming increasingly important for information retrieval and knowledge assistance. To make the Rules Engine documentation content available in text-based formats that are easier for LLMs to process, ingest, and work with, you can leverage the following llms.txt files.

  • Index — contains an index of all the page URLs and titles of the Rules Engine docs site, providing a comprehensive list of all available markdown-formatted pages:

https://docs.commercelayer.io/rules-engine/llms.txt
  • Full content — contains the full content of the Rules Engine docs site in one file that can be passed to LLMs as context:

https://docs.commercelayer.io/rules-engine/llms-full.txt

Following a clear separation of concerns, each Commerce Layer API doc site has its own LLM files. The one above indexes information about the Rules Engine only. Check also: Core API, Metrics API, and Provisioning API.

MCP server

Model Context Protocol gives AI tools a structured way to discover and retrieve your docs as resources — no scraping required. To allow AI assistants to access the Rules Engine documentation content directly, making it easy for tools like Claude Desktop, Cursor, and VS Code extensions to answer questions using the docs, we expose via HTTP an MCP server at the following URL:

https://docs.commercelayer.io/rules-engine/~gitbook/mcp

Following a clear separation of concerns, each Commerce Layer API docs site has its own MCP server so that you can connect, activate, and deactivate them based on your needs. The one above is related the Rules Engine only. Check also: Core API, Metrics API, and Provisioning API.

Last updated