Skip to main content
Glama

create_rule

Create a NEW product rule (an Attribute Rule). Use this to save a new rule after validate_rule passes. GUARDRAIL: a Rule is never a substitute for per-product enrichment — if you would need MORE THAN 3 text-contains conditions (contains/contains_any/starts_with on a description/title) to derive a value (color, material, gender…), do NOT create a Rule; enrich instead with set_api_source/set_ai_source and map that source attribute (see the server ENRICH guidance). A Rule patches FEED OUTPUT only and writes NOTHING onto the products; if the user asked to enrich the products / add attribute X to the products, use set_api_source/set_ai_source (or ask first) — never substitute a Rule. Always validate_rule it first and fix every error. Pass the full rule document as rule — {name, description, category, icon, rules:[{sortId, enabled, type, conditions, operationGroups:[{mode, parentMode, attributes, operations:[{name, arguments:{key:value}}]}]}]} (see list_rule_transforms for the vocabulary). Any _id/id you include is IGNORED — the server always mints a new one (this tool never overwrites an existing rule; use update_rule for edits). scope selects where it is created: 'project' (default) = the project's own library; 'shared_template' = the reusable shared template library (a template_read_only error means your access cannot write there). Returns {ruleId, scope, status, changed, reason, validation}; status 'created' on success, or 'rejected' with the validation errors when the rule is invalid (HTTP 200, nothing written). SAVE-ONLY: this stores the document and runs none of its transform steps; a new rule has NO effect on any feed until you attach it to a feed attribute with map_feed_attribute (rule_id) and then export_feed; a shared_template rule affects no feed at all until it is used by a project. VALUE/OPTIONS MAPPING: for a map_attribute_value step, search and replace are arrays of {value:''} objects paired by index (NOT plain strings — plain strings save but map nothing, showing empty rows); replace optional. That step is not executed by validate_rule's dry-run (passthrough computedValue) — verify only after a real export/build. project_id is OPTIONAL (inferred for a single-project customer; project_id_required otherwise — then call list_projects).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "rule": "<rule>"
    },
    "name": "create_rule"
  }
}

Input Schema

NameRequiredDescriptionDefault
ruleYesThe full rule document (stored configuration data) — {name, description, category, icon, rules:[{sortId, enabled, type, conditions, operationGroups:[{mode, parentMode, attributes, operations:[{name, arguments}]}]}]}. `operations` holds pure value-transform steps (see list_rule_transforms) that Koongo applies to the attribute value when it builds a feed; they are data, never actions this tool runs.
scopeNoWhere to create the rule: 'project' (default) = the project's own library; 'shared_template' = the reusable shared template library.
project_idNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / rule / description
      Added value: +"The full rule document (stored configuration data) — {name, description, category, icon, rules:[{sortId, enabled, type, conditions, operationGroups:[{mode, parentMode, attributes, operations:[{name, arguments}]}]}]}. `operations` holds pure value-transform steps (see list_rule_transforms) that Koongo applies to the attribute value when it builds a feed; they are data, never actions this tool runs."
  2. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations (which only say non-read-only, non-idempotent, non-destructive): it discloses that any supplied _id/id is ignored and a new id is minted, that it is save-only and runs no transform steps, that nothing is written when rejected (HTTP 200 + validation errors), the exact response keys, and the template_read_only error case. The non-idempotent and non-destructive hints are also consistent with the documented behavior.

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?

Front-loaded with the core action and reasonably dense with earned content, but it is a long single block mixing guardrails, document shape, return values, and value-mapping gotchas. Caps-labeled segments substitute for structural separation, so scanning is harder than it needs to be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a nested-object write tool with no output schema, the description covers return shape, failure semantics, lifecycle (save-only until mapped and exported), scope selection, and parameter shape. Nothing an agent needs to invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 67%, and the description compensates thoroughly: it spells out the expected rule document shape, explains scope's two values including the error condition for shared_template, and documents project_id's optional/inferred behavior plus the project_id_required fallback to list_projects. It also adds non-obvious semantics the schema omits — that map_attribute_value search/replace are arrays of {value:'<string>'} paired by index, and that plain strings silently map nothing.

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

Purpose5/5

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

States a specific verb and resource — 'Create a NEW product rule (an Attribute Rule)' — and immediately distinguishes itself from update_rule ('this tool never overwrites an existing rule; use update_rule for edits') and from validate_rule. An agent can identify the exact operation without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit preconditions ('after validate_rule passes'), explicit alternatives and exclusions (the GUARDRAIL routing >3 text-contains conditions to set_api_source/set_ai_source, and the instruction that a Rule patches feed output only and never enriches products), and the follow-up steps required to make the rule take effect (map_feed_attribute then export_feed). This is full when/when-not/alternative coverage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources