@mambasms/mcp-server 0.7.24 → 0.7.25
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.
- package/index.js +13 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -123,7 +123,7 @@ function defineTool(name, description, shape, handler) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const server = new McpServer(
|
|
126
|
-
{ name: "mambasms-mcp-server", version: "0.7.
|
|
126
|
+
{ name: "mambasms-mcp-server", version: "0.7.25" },
|
|
127
127
|
{
|
|
128
128
|
instructions: `MambaSMS 营销自动化(店铺级,鉴权用 MAMBA_ACCESS_TOKEN 店铺密钥)。共 66 个工具,分四组。
|
|
129
129
|
不确定用什么/想先看总览 → mamba_guide;只知道关键词 → mamba_search;要参数细节 → mamba_tool_schema。
|
|
@@ -164,12 +164,18 @@ defineTool(
|
|
|
164
164
|
// 预览是"变量替换后的渲染",但部分变量(联系人邮箱/评价链接等)无上下文时会保留原占位符;
|
|
165
165
|
// 不说明的话 AI 会以为模板写错了,或者把占位符当正文再回写
|
|
166
166
|
try {
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
// /template/details 返回的是数组,逐个补提示(之前只处理对象,导致提示永远不出现)
|
|
168
|
+
const items = Array.isArray(data) ? data : [data];
|
|
169
|
+
for (const item of items) {
|
|
170
|
+
if (!item || typeof item !== "object") continue;
|
|
171
|
+
const html = String(item.htmlContext || item.html || item.content || "");
|
|
172
|
+
const left = [...new Set((html.match(/\{[A-Za-z][A-Za-z0-9_]*\}/g) || []))]
|
|
173
|
+
.filter((x) => x !== "{Unsubscribe}");
|
|
174
|
+
if (left.length) {
|
|
175
|
+
item.placeholdersRemaining = left.slice(0, 20);
|
|
176
|
+
item.placeholderNote = "以下占位符在预览里没有被替换(需要收件人/订单上下文),发送时会按真实数据渲染,不是模板写错;"
|
|
177
|
+
+ "不要把预览 HTML 当原模板回写";
|
|
178
|
+
}
|
|
173
179
|
}
|
|
174
180
|
} catch (e) { /* ignore */ }
|
|
175
181
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
package/package.json
CHANGED