Skip to main content
Glama

Create product matching rule

create_item_mapping_rule
Destructive

Create Rule Mapping

When to use: 조건(상품명·옵션명 등)에 맞는 옵션을 기초상품에 자동으로 연결하는 상품 매칭 규칙을 새로 하나 만들 때. 웹 「상품 매칭 > 규칙 설정」의 규칙 추가와 같은 동작이다.

When NOT to use: 이미 있는 규칙을 고치거나 순서만 바꾸려면 update_item_rule_mapping. 옵션 몇 개만 직접 연결하려면 규칙이 아니라 update_item_relation. 규칙을 지우려면 delete_item_mapping_rule.

Limitations: 생성 전용 — 기존 규칙을 고치지 않는다(항상 새 규칙). 필수 필드는 mapping_name·mapping_item·mapping_rule 이다. 같은 이름의 상품 규칙이 이미 있으면 400. priority 위치: 비우거나 0 이면 맨 뒤에 붙는다(광고 규칙까지 포함한 모든 매핑 규칙 중 가장 큰 priority 보다 1 큰 값이라 마지막 상품 규칙의 priority 보다 클 수 있지만, 상품 규칙 중에서는 여전히 마지막이다). 1 이상을 주면 그 값으로 들어가고, 그 값 이상인 기존 상품 규칙(MANUAL·EASYADMIN 기본 매핑 포함)이 모두 1씩 뒤로 밀린다. 응답에 새 규칙의 seq 가 없으므로 list_item_mappings에서 mapping_name 으로 찾는다. mapping_rule 은 규칙 AST 다(_typeTag: BinFunction/And/Or, 리프는 lhs·_functionName·rhs). lhs 는 옵션의 문자열 컬럼(brand_name·channel_name·product_id·product_name·option_id·option_name), _functionName 은 EQ·NE·IN·NOT_IN·LIKE·NOT_LIKE·START_WITH·END_WITH·NULL·NOT_NULL 을 쓴다. LIKE·NOT_LIKE 는 rhs 를 부분일치로 감싸고 % 와 _ 를 이스케이프하므로 rhs 에 % 를 넣지 않는다(넣으면 글자 % 를 찾는다). START_WITH·END_WITH 는 이스케이프하지 않아 % 와 _ 가 와일드카드로 동작한다(예: "50%" 는 50 으로 시작하는 모든 값에 매칭) — 이 둘의 rhs 에는 % 와 _ 를 피한다. 실제 매칭은 mapping_rule 로만 계산되고 mapping_rule_fe 는 웹 규칙 편집 화면의 표현이다 — 비우면 매칭은 되지만 웹 편집 화면에는 조건이 비어 보인다. 화면 형식이 필요하면 웹에서 만든 규칙을 get_item_rule_mapping 으로 읽어 같은 모양으로 넘긴다. mapping_item 은 연결할 기초상품 목록(item_brand_name·item_id·item_name·item_qty, is_gift 선택)이다. 쓰기 직전 상태는 복원 지점으로 따로 찍히지 않는다 — data_mapping+ITEM 스코프 이력 이벤트만 남고, 체크포인트는 다음 배치 주기에 변경 뒤 상태로 찍힌다. 되돌릴 기준점이 필요하면 쓰기 전에 create_restore_point(entity_type=data_mapping, entity_id=ITEM)로 먼저 복원 지점을 만든다. 되돌리기 자체는 MCP 도구로 열려 있지 않아 웹에서 한다(라플라스 웹 데이터 관리 화면의 「버전 히스토리」). 복원은 규칙 하나가 아니라 상품 매칭 규칙(ITEM) 전체를 그 시점으로 되돌린다 — 복원 지점 뒤에 만들거나 고친 다른 상품 규칙도 함께 되돌아간다. priority 는 숫자가 작을수록 먼저 적용된다. 저장하면 데이터 마트 갱신 요청이 나간다. 매칭 결과(파생 테이블)에 바로 반영하려면 규칙을 모두 고친 뒤 refresh_cogs_relation을 한 번 부른다. data_management:write 권한 + ITEM_MAPPING 스코프 필요.

Examples:

  • Q: 상품명에 '수분크림'이 들어가면 '수분크림 50ml' 기초상품으로 연결하는 규칙을 만들어줘 params: {'body': {'mapping_name': '수분크림 규칙', 'mapping_item': [{'item_brand_name': '브랜드A', 'item_id': 'SKU-1', 'item_name': '수분크림 50ml', 'item_qty': 1}], 'mapping_rule': {'_typeTag': 'BinFunction', '_functionName': 'LIKE', 'lhs': 'product_name', 'rhs': '수분크림'}}}

  • Q: 상품명에 '수분크림'이 들어가는 매칭 규칙을 맨 앞 순서로 만들어줘 params: {'body': {'mapping_name': '수분크림 규칙', 'priority': 1, 'mapping_item': [{'item_brand_name': '브랜드A', 'item_id': 'SKU-1', 'item_name': '수분크림 50ml', 'item_qty': 1}], 'mapping_rule': {'_typeTag': 'BinFunction', '_functionName': 'LIKE', 'lhs': 'product_name', 'rhs': '수분크림'}}}

Output shape: no content (성공 시 body 없음)

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": {
      "mapping_name": "<mapping_name>",
      "mapping_item": "<mapping_item>",
      "mapping_rule": "<mapping_rule>"
    },
    "name": "create_item_mapping_rule"
  }
}

Input Schema

NameRequiredDescriptionDefault
priorityNo
project-idNo
auth_methodNojwt
mapping_itemYes
mapping_nameYes
mapping_ruleYes
mapping_rule_feNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Goes far beyond the annotations: discloses the 400 on duplicate names, that priority auto-assigns to the end of the ordering, that existing rules at or above the given priority get shifted by one (a real side effect matching destructiveHint), and that the response carries no seq so the new rule must be found via list_item_mappings. It also states required permission/scope (data_management:write + ITEM_MAPPING) and explains that the write is not a restore point and that restoring reverts the entire ITEM scope, with a pointer to create_restore_point beforehand.

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?

Well front-loaded with labeled sections (When to use / When NOT to use / Limitations / Examples) and two worked examples. The Limitations block is one long dense paragraph mixing priority ordering, AST syntax, restore semantics, and permissions, which makes it harder to scan 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 destructive, nested-schema, seven-parameter create tool with no output schema, it supplies everything an agent needs: required fields, enum-like operator lists, ordering side effects, error condition, permission requirement, follow-up lookup, and an explicit statement that success returns no body. Nothing material 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?

With 0% schema description coverage the description must carry the load, and it does: it defines the AST shape for mapping_rule (_typeTag, lhs column whitelist, _functionName operator whitelist with LIKE vs START_WITH escaping caveats) and clarifies that mapping_rule_fe is display-only. It also documents the mapping_item sub-fields, priority semantics, and which fields are required; only project-id and auth_method are left unmentioned, but they are clearly plumbing.

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 (create) and resource (product matching rule that auto-links options to base products) and anchors it to a concrete UI location, so the agent knows exactly what is produced. It also explicitly distinguishes itself from the four sibling operations an agent might confuse it with.

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?

Has dedicated 'When to use' and 'When NOT to use' sections naming the exact alternatives: update_item_rule_mapping for edits/reordering, update_item_relation for manual option links, delete_item_mapping_rule for removal. The selection conditions are stated, not inferred.

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