@mambasms/mcp-server 0.6.15 → 0.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,137 +1,139 @@
1
- # 分组条件写法(query_content)
2
-
3
- 真源:`group_catalog()` 与 `group_catalog(nested_path=...)`。**建组前必须先查**,否则 `user_group_create` 会被拒绝(查过一次 30 分钟内免再查)。
4
-
5
- ## 1. 二维结构
6
-
7
- ```
8
- query_content = [
9
- [ 条件A, 条件B ], ← OR 组 1:A 且 B
10
- [ 条件C ] ← OR 组 2:C (组间是"或")
11
- ]
12
- ```
13
-
14
- | 用户说法 | 正确写法 | 错误写法 |
15
- |---|---|---|
16
- | A 或 B | `[[A],[B]]` | `[[A,B]]`(变成"且") |
17
- | A 且 B | `[[A,B]]` | `[[A],[B]]` |
18
- | A 且 (B 或 C) | `[[A,B],[A,C]]` | `[[A],[B,C]]` |
19
- | (A 或 B) 且 非 C | `[[A,NOT_C],[B,NOT_C]]` | `[[A],[B],[NOT_C]]`(NOT_C 变成独立或分支) |
20
-
21
- > 共享的排除条件必须**在每个 OR 组内重复**。
22
-
23
- 条件对象:
24
-
25
- ```json
26
- { "condition": "gte", "field": "number", "logic": "must",
27
- "nestedPath": "success_checkout", "script": false, "value": "1" }
28
- ```
29
-
30
- - `condition` 操作符
31
- - `field` 字段(必须来自目录)
32
- - `logic` `must` / `must_not`
33
- - `nestedPath` 数据域(基础属性传 `""`;有 nestedPath 时 `script` 必须 `false`)
34
- - `value` 单值字符串;多值用 `"termsValue": ["a","b"]`
35
-
36
- ## 2. 操作符白名单
37
-
38
- | 操作符 | 用途 |
39
- |---|---|
40
- | `gte` / `gt` / `lt` / `lte` | 数值、日期比较(“超过 N”=`gt`,“不低于 N”=`gte`,“少于”=`lt`) |
41
- | `term_query` | 精确匹配(枚举、布尔、字符串精确值) |
42
- | `terms_query` | 多选,配 `termsValue` 数组(商品系列 id、订单标签等) |
43
- | `fuzzy_query` / `not_fuzzy_query` | 字符串包含 / 不包含(商品名、城市等) |
44
- | `exists_field` / `exists_field_not` | 字段有值 / 无值 |
45
-
46
- **禁止**:`eq`、`un_eq`、`empty`、`don_empty` —— 引擎不认识,条件会被**静默丢弃**(查出来是全部人或空集,很难发现)。
47
-
48
- ## 3. 时间写法
49
-
50
- 时间必须写在 `value` 字符串里,**不能**写成独立 JSON 属性:
51
-
52
- ```json
53
- {"condition":"gte","field":"date_day","logic":"must","nestedPath":"success_checkout","script":false,"value":"formerly:30"}
54
- ```
55
-
56
- | 语义 | value |
57
- |---|---|
58
- | 近 N 天(滚动窗口) | `formerly:30`(近 30 天);`formerly:1` = 近 24 小时 |
59
- | 绝对日期 | `YYYYMMDD`,如 `20240101` |
60
- | 区间 | 同组两条:`gte` 起始 + `lte` 结束 |
61
-
62
- 规则:
63
- - 行为的时间窗必须配**该行为自己的** `date_day` + `nestedPath`(“近 30 天下单”= `success_checkout` 的 `date_day`)
64
- - **不传 `nestedPath` 的 `date_day` 是注册时间**——想表达“最近下单”却写成基础属性 `date_day`,筛出来的是“最近注册的人”
65
- - `order_details` / `checkout_details` 等明细表**没有 `date_day`**,订单时间一律配在 `success_checkout` 上
66
-
67
- ## 4. 常用数据域(nestedPath)
68
-
69
- | 需求 | nestedPath | 关键字段 |
70
- |---|---|---|
71
- | 下过单 / 下单次数 | `success_checkout` | `number`、`date_day`、`total_price`(累计)、`average_price`、`single_order_amount`(单笔) |
72
- | 完成订单 / 取消 / 退款 | `success_order` / `cancel_order` / `refund_order` | `number` |
73
- | 订单属性 | `order_details` | `origin_status`(paid/pending/refunded…)、`origin_shipping_status`(FULFILLED/UNFULFILLED/PARTIAL)、`item_title`、`item_origin_product_sn`、`tags` |
74
- | 购买过的系列 | `order_collection` | `id`(`terms_query` + `termsValue`,没有系列 id 不要编造) |
75
- | 浏览商品 / 页面 | `browse_products` / `browse_page` | `title`、`item_url` / `page`(URL 片段) |
76
- | 加购 | `shopping_cart` | `number`、`total_price` |
77
- | 加购明细 | `shopping_cart_details` | `product_id` |
78
- | 弃单 | `abandon_checkout` | `number`、`total_price` |
79
- | 弃单明细 | `checkout_details` | `item_title`、`item_origin_product_sn` |
80
- | 国家(基础属性) | `""` | `country`(`US`/`DE`/`GB`…) |
81
- | 州/城市(住址) | `audience_address` | `state`、`city` |
82
- | 手机号归属州(美国) | `""` | `phone_state`(州代码 `TX`/`CA`,不是州名) |
83
- | 活动打开 / 点击 / 收信 | `campaign_open_number` / `campaign_click_number` / `campaign_email_records` | `number`、`date_day` |
84
- | 活动退信 / 投诉 / 失败 | `campaign_bounce_records` / `campaign_complaint_records` / `campaign_fail_records` | `number`(“从未有”用 `term_query` + `value:"0"`) |
85
- | 活动参与明细(含退订) | `campaign_details` | `is_unsubscribe`、`open`、`click`、`send_type`、`content_type`(email/sms) |
86
- | 自动化邮件打开 / 点击 | `flow_open_number` / `flow_click_number` | `number` |
87
- | 某流程触发 | `flow_details` | `flow_id`(不知道 id 时用 `contains_query` + 流程名关键词) |
88
- | 用户评价 | `judgeme_reviews` | `rating`、`is_review_positive`、`published` |
89
-
90
- ## 5. 常用组合示例
91
-
92
- ```json
93
- // ① 近 30 天下单 ≥1(行为 + 时间窗)
94
- [[{"condition":"gte","field":"number","logic":"must","nestedPath":"success_checkout","script":false,"value":"1"},
95
- {"condition":"gte","field":"date_day","logic":"must","nestedPath":"success_checkout","script":false,"value":"formerly:30"}]]
96
-
97
- // ② 美国客户(基础属性,nestedPath 空串)
98
- [[{"condition":"term_query","field":"country","logic":"must","nestedPath":"","value":"US"}]]
99
-
100
- // ③ 美国 且 下过单(同组 AND)
101
- [[{"condition":"term_query","field":"country","logic":"must","nestedPath":"","value":"US"},
102
- {"condition":"gte","field":"number","logic":"must","nestedPath":"success_checkout","script":false,"value":"1"}]]
103
-
104
- // ④ 高价值:累计消费 ≥ 1000 且 排除已退订(注意:退订条件只在用户明确提到时才加)
105
- [[{"condition":"gte","field":"total_price","logic":"must","nestedPath":"success_checkout","script":false,"value":"1000"},
106
- {"condition":"term_query","field":"is_email_subscriptions","logic":"must","nestedPath":"","value":"1"}]]
107
-
108
- // ⑤ 从未投诉(计数表 + 0)
109
- [[{"condition":"term_query","field":"number","logic":"must","nestedPath":"campaign_complaint_records","script":false,"value":"0"}]]
110
-
111
- // ⑥ 打开过某个自动化流程的邮件(流程条件 + 计数两条同组)
112
- [[{"condition":"term_query","field":"flow_id","logic":"must","nestedPath":"flow_details","value":"<流程id>"},
113
- {"condition":"gte","field":"number","logic":"must","nestedPath":"flow_open_number","script":false,"value":"1"}]]
114
-
115
- // ⑦ 活动里点过退订链接(区别于订阅状态字段)
116
- [[{"condition":"term_query","field":"is_unsubscribe","logic":"must","nestedPath":"campaign_details","value":"1"}]]
117
- ```
118
-
119
- ## 6. 高频坑
120
-
121
- | 坑 | 说明 |
122
- |---|---|
123
- | 编造字段/路径 | 会被后端 412 打回(`存在系统不支持的字段`)→ 用目录里的真实字段重写 |
124
- | 用 `eq`/`un_eq` | 条件被静默丢弃,人数组完全不对 |
125
- | 把 `formerly` 写成独立属性 | 时间失效、条件无值,前端渲染成“请选择” |
126
- | 行为时间写成基础属性 `date_day` | 变成“按注册时间筛”,与需求完全不同 |
127
- | 用触发器名当 nestedPath | `customer_created`/`join_cart` 不是数据域,会被拒 |
128
- | 用户没提订阅却加订阅条件 | 人群被错误缩小,属多余条件,会被语义校验拦 |
129
- | `single_order_amount` 配 `date_day` | 会渲染成“最后下单时间”;金额按全部历史判断,需向用户说明 |
130
- | 金额单位 | 按店铺货币(常为 CNY);用户说美元时按 1:7 换算并说明 |
131
-
132
- ## 7. 建组之后
133
-
134
- - `status=draft`,人数由后台**异步打包**(通常数十秒)
135
- - `group_list(keyword=...)` 看 `userCount` 与 `dynamicStatus=complete`
136
- - `group_members(group_id=...)` 看成员明细(自动区分手动/条件分组两套存储)
137
- - 活动指定该人群:`communication_select="tag"` + `tag_id=<分组id>`
1
+ # 分组条件写法(query_content)
2
+
3
+ > 返回入口:[`../SKILL.md`](../SKILL.md) | 按任务:`../modules/templates.md`(模板)、`../modules/campaigns.md`(活动)、`../modules/flows.md`(流程)、`../modules/audiences.md`(人群)、`../modules/reports.md`(报表)、`../modules/assets-and-social.md`(图片/社媒)
4
+
5
+ 真源:`group_catalog()` 与 `group_catalog(nested_path=...)`。**建组前必须先查**,否则 `user_group_create` 会被拒绝(查过一次 30 分钟内免再查)。
6
+
7
+ ## 1. 二维结构
8
+
9
+ ```
10
+ query_content = [
11
+ [ 条件A, 条件B ], ← OR 组 1:A 且 B
12
+ [ 条件C ] ← OR 组 2:C (组间是"或")
13
+ ]
14
+ ```
15
+
16
+ | 用户说法 | 正确写法 | 错误写法 |
17
+ |---|---|---|
18
+ | A 或 B | `[[A],[B]]` | `[[A,B]]`(变成"且") |
19
+ | A 且 B | `[[A,B]]` | `[[A],[B]]` |
20
+ | A 且 (B 或 C) | `[[A,B],[A,C]]` | `[[A],[B,C]]` |
21
+ | (A 或 B) 且 非 C | `[[A,NOT_C],[B,NOT_C]]` | `[[A],[B],[NOT_C]]`(NOT_C 变成独立或分支) |
22
+
23
+ > 共享的排除条件必须**在每个 OR 组内重复**。
24
+
25
+ 条件对象:
26
+
27
+ ```json
28
+ { "condition": "gte", "field": "number", "logic": "must",
29
+ "nestedPath": "success_checkout", "script": false, "value": "1" }
30
+ ```
31
+
32
+ - `condition` 操作符
33
+ - `field` 字段(必须来自目录)
34
+ - `logic` `must` / `must_not`
35
+ - `nestedPath` 数据域(基础属性传 `""`;有 nestedPath 时 `script` 必须 `false`)
36
+ - `value` 单值字符串;多值用 `"termsValue": ["a","b"]`
37
+
38
+ ## 2. 操作符白名单
39
+
40
+ | 操作符 | 用途 |
41
+ |---|---|
42
+ | `gte` / `gt` / `lt` / `lte` | 数值、日期比较(“超过 N”=`gt`,“不低于 N”=`gte`,“少于”=`lt`) |
43
+ | `term_query` | 精确匹配(枚举、布尔、字符串精确值) |
44
+ | `terms_query` | 多选,配 `termsValue` 数组(商品系列 id、订单标签等) |
45
+ | `fuzzy_query` / `not_fuzzy_query` | 字符串包含 / 不包含(商品名、城市等) |
46
+ | `exists_field` / `exists_field_not` | 字段有值 / 无值 |
47
+
48
+ **禁止**:`eq`、`un_eq`、`empty`、`don_empty` —— 引擎不认识,条件会被**静默丢弃**(查出来是全部人或空集,很难发现)。
49
+
50
+ ## 3. 时间写法
51
+
52
+ 时间必须写在 `value` 字符串里,**不能**写成独立 JSON 属性:
53
+
54
+ ```json
55
+ {"condition":"gte","field":"date_day","logic":"must","nestedPath":"success_checkout","script":false,"value":"formerly:30"}
56
+ ```
57
+
58
+ | 语义 | value |
59
+ |---|---|
60
+ | 近 N 天(滚动窗口) | `formerly:30`(近 30 天);`formerly:1` = 近 24 小时 |
61
+ | 绝对日期 | `YYYYMMDD`,如 `20240101` |
62
+ | 区间 | 同组两条:`gte` 起始 + `lte` 结束 |
63
+
64
+ 规则:
65
+ - 行为的时间窗必须配**该行为自己的** `date_day` + `nestedPath`(“近 30 天下单”= `success_checkout` 的 `date_day`)
66
+ - **不传 `nestedPath` 的 `date_day` 是注册时间**——想表达“最近下单”却写成基础属性 `date_day`,筛出来的是“最近注册的人”
67
+ - `order_details` / `checkout_details` 等明细表**没有 `date_day`**,订单时间一律配在 `success_checkout` 上
68
+
69
+ ## 4. 常用数据域(nestedPath)
70
+
71
+ | 需求 | nestedPath | 关键字段 |
72
+ |---|---|---|
73
+ | 下过单 / 下单次数 | `success_checkout` | `number`、`date_day`、`total_price`(累计)、`average_price`、`single_order_amount`(单笔) |
74
+ | 完成订单 / 取消 / 退款 | `success_order` / `cancel_order` / `refund_order` | `number` |
75
+ | 订单属性 | `order_details` | `origin_status`(paid/pending/refunded…)、`origin_shipping_status`(FULFILLED/UNFULFILLED/PARTIAL)、`item_title`、`item_origin_product_sn`、`tags` |
76
+ | 购买过的系列 | `order_collection` | `id`(`terms_query` + `termsValue`,没有系列 id 不要编造) |
77
+ | 浏览商品 / 页面 | `browse_products` / `browse_page` | `title`、`item_url` / `page`(URL 片段) |
78
+ | 加购 | `shopping_cart` | `number`、`total_price` |
79
+ | 加购明细 | `shopping_cart_details` | `product_id` |
80
+ | 弃单 | `abandon_checkout` | `number`、`total_price` |
81
+ | 弃单明细 | `checkout_details` | `item_title`、`item_origin_product_sn` |
82
+ | 国家(基础属性) | `""` | `country`(`US`/`DE`/`GB`…) |
83
+ | 州/城市(住址) | `audience_address` | `state`、`city` |
84
+ | 手机号归属州(美国) | `""` | `phone_state`(州代码 `TX`/`CA`,不是州名) |
85
+ | 活动打开 / 点击 / 收信 | `campaign_open_number` / `campaign_click_number` / `campaign_email_records` | `number`、`date_day` |
86
+ | 活动退信 / 投诉 / 失败 | `campaign_bounce_records` / `campaign_complaint_records` / `campaign_fail_records` | `number`(“从未有”用 `term_query` + `value:"0"`) |
87
+ | 活动参与明细(含退订) | `campaign_details` | `is_unsubscribe`、`open`、`click`、`send_type`、`content_type`(email/sms) |
88
+ | 自动化邮件打开 / 点击 | `flow_open_number` / `flow_click_number` | `number` |
89
+ | 某流程触发 | `flow_details` | `flow_id`(不知道 id 时用 `contains_query` + 流程名关键词) |
90
+ | 用户评价 | `judgeme_reviews` | `rating`、`is_review_positive`、`published` |
91
+
92
+ ## 5. 常用组合示例
93
+
94
+ ```json
95
+ // ① 近 30 天下单 ≥1(行为 + 时间窗)
96
+ [[{"condition":"gte","field":"number","logic":"must","nestedPath":"success_checkout","script":false,"value":"1"},
97
+ {"condition":"gte","field":"date_day","logic":"must","nestedPath":"success_checkout","script":false,"value":"formerly:30"}]]
98
+
99
+ // ② 美国客户(基础属性,nestedPath 空串)
100
+ [[{"condition":"term_query","field":"country","logic":"must","nestedPath":"","value":"US"}]]
101
+
102
+ // ③ 美国 且 下过单(同组 AND)
103
+ [[{"condition":"term_query","field":"country","logic":"must","nestedPath":"","value":"US"},
104
+ {"condition":"gte","field":"number","logic":"must","nestedPath":"success_checkout","script":false,"value":"1"}]]
105
+
106
+ // ④ 高价值:累计消费 ≥ 1000 且 排除已退订(注意:退订条件只在用户明确提到时才加)
107
+ [[{"condition":"gte","field":"total_price","logic":"must","nestedPath":"success_checkout","script":false,"value":"1000"},
108
+ {"condition":"term_query","field":"is_email_subscriptions","logic":"must","nestedPath":"","value":"1"}]]
109
+
110
+ // ⑤ 从未投诉(计数表 + 0)
111
+ [[{"condition":"term_query","field":"number","logic":"must","nestedPath":"campaign_complaint_records","script":false,"value":"0"}]]
112
+
113
+ // ⑥ 打开过某个自动化流程的邮件(流程条件 + 计数两条同组)
114
+ [[{"condition":"term_query","field":"flow_id","logic":"must","nestedPath":"flow_details","value":"<流程id>"},
115
+ {"condition":"gte","field":"number","logic":"must","nestedPath":"flow_open_number","script":false,"value":"1"}]]
116
+
117
+ // ⑦ 活动里点过退订链接(区别于订阅状态字段)
118
+ [[{"condition":"term_query","field":"is_unsubscribe","logic":"must","nestedPath":"campaign_details","value":"1"}]]
119
+ ```
120
+
121
+ ## 6. 高频坑
122
+
123
+ | 坑 | 说明 |
124
+ |---|---|
125
+ | 编造字段/路径 | 会被后端 412 打回(`存在系统不支持的字段`)→ 用目录里的真实字段重写 |
126
+ | 用 `eq`/`un_eq` | 条件被静默丢弃,人数组完全不对 |
127
+ | 把 `formerly` 写成独立属性 | 时间失效、条件无值,前端渲染成“请选择” |
128
+ | 行为时间写成基础属性 `date_day` | 变成“按注册时间筛”,与需求完全不同 |
129
+ | 用触发器名当 nestedPath | `customer_created`/`join_cart` 不是数据域,会被拒 |
130
+ | 用户没提订阅却加订阅条件 | 人群被错误缩小,属多余条件,会被语义校验拦 |
131
+ | `single_order_amount` 配 `date_day` | 会渲染成“最后下单时间”;金额按全部历史判断,需向用户说明 |
132
+ | 金额单位 | 按店铺货币(常为 CNY);用户说美元时按 1:7 换算并说明 |
133
+
134
+ ## 7. 建组之后
135
+
136
+ - `status=draft`,人数由后台**异步打包**(通常数十秒)
137
+ - `group_list(keyword=...)` 看 `userCount` 与 `dynamicStatus=complete`
138
+ - `group_members(group_id=...)` 看成员明细(自动区分手动/条件分组两套存储)
139
+ - 活动指定该人群:`communication_select="tag"` + `tag_id=<分组id>`
@@ -1,4 +1,6 @@
1
- # 工具参数清单(52 个,v0.6.4)
1
+ # 工具参数清单(52 个,以 `mamba_tool_schema` 为准)
2
+
3
+ > 返回入口:[`../SKILL.md`](../SKILL.md) | 按任务:`../modules/templates.md`(模板)、`../modules/campaigns.md`(活动)、`../modules/flows.md`(流程)、`../modules/audiences.md`(人群)、`../modules/reports.md`(报表)、`../modules/assets-and-social.md`(图片/社媒)
2
4
 
3
5
  `req` = 必填参数;其余为可选。类型以 `mamba_tool_schema(name)` 返回为准。
4
6
 
@@ -1,5 +1,7 @@
1
1
  # 排错与环境
2
2
 
3
+ > 返回入口:[`../SKILL.md`](../SKILL.md) | 按任务:`../modules/templates.md`(模板)、`../modules/campaigns.md`(活动)、`../modules/flows.md`(流程)、`../modules/audiences.md`(人群)、`../modules/reports.md`(报表)、`../modules/assets-and-social.md`(图片/社媒)
4
+
3
5
  ## 1. 环境
4
6
 
5
7
  | 项 | 值 |