chaimi-keep-mcp 3.1.40-beta.2 → 3.1.40-beta.3
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/SKILL.md +18 -2
- package/package.json +1 -1
- package/server.js +127 -10
package/SKILL.md
CHANGED
|
@@ -205,7 +205,15 @@ get_statistics period="this_week"
|
|
|
205
205
|
|
|
206
206
|
Agent **直接使用当前时间**作为消费时间,无需进行时间语义解析。
|
|
207
207
|
|
|
208
|
-
**最终传入的 `date` 参数格式:**毫秒级时间戳(13位数字)⚠️
|
|
208
|
+
**最终传入的 `date` 参数格式:**毫秒级时间戳(13位数字)⚠️ **⚠️ ⚠️ 重要 ⚠️ ⚠️ ⚠️**:
|
|
209
|
+
|
|
210
|
+
- **必须使用 date 命令计算时间戳,禁止手动填写或猜测**
|
|
211
|
+
- **强制使用以下命令:**
|
|
212
|
+
```bash
|
|
213
|
+
date -j -f "%Y-%m-%d %H:%M:%S" "YYYY-MM-DD HH:MM:SS" +%s000
|
|
214
|
+
```
|
|
215
|
+
- 如果未使用 date 命令计算,服务端将拒绝保存
|
|
216
|
+
- 示例格式:`2026-04-20 18:30:00` → `1776604200000`(北京时间),禁止使用示例中的具体数字,必须根据实际时间计算
|
|
209
217
|
|
|
210
218
|
**必填字段:** `name`、`amount`、`category`、`date`
|
|
211
219
|
|
|
@@ -238,7 +246,15 @@ Agent **直接使用当前时间**作为收入时间,无需进行时间语义
|
|
|
238
246
|
|
|
239
247
|
**必填字段:**
|
|
240
248
|
- `store`:商家名称
|
|
241
|
-
- `date`:毫秒时间戳(13位数字,格式:`[毫秒时间戳]
|
|
249
|
+
- `date`:毫秒时间戳(13位数字,格式:`[毫秒时间戳]`),小票上的真实消费时间,⚠️ **⚠️ ⚠️ 重要 ⚠️ ⚠️ ⚠️**:
|
|
250
|
+
|
|
251
|
+
- **必须使用 date 命令计算时间戳,禁止手动填写或猜测**
|
|
252
|
+
- **强制使用以下命令:**
|
|
253
|
+
```bash
|
|
254
|
+
date -j -f "%Y-%m-%d %H:%M:%S" "YYYY-MM-DD HH:MM:SS" +%s000
|
|
255
|
+
```
|
|
256
|
+
- 如果未使用 date 命令计算,服务端将拒绝保存
|
|
257
|
+
- 禁止使用示例中的具体数字,必须根据小票上的实际时间重新计算
|
|
242
258
|
- `totalAmount`:商品原价总和
|
|
243
259
|
- `actualAmount`:实付金额(优惠后)
|
|
244
260
|
- `originalAmount`:原价(优惠前)
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -958,9 +958,39 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
958
958
|
const toolName = toolMapping[name];
|
|
959
959
|
const mcpParams = convertParams(name, processedArgs);
|
|
960
960
|
result = await callMcpHub(toolName, mcpParams, token);
|
|
961
|
-
|
|
961
|
+
|
|
962
962
|
if (result.success) {
|
|
963
|
-
|
|
963
|
+
const total = result.data?.total || 0;
|
|
964
|
+
const items = result.data?.items || [];
|
|
965
|
+
const patterns = result.data?.patterns || {};
|
|
966
|
+
|
|
967
|
+
// 构建友好的摘要信息
|
|
968
|
+
let summary = `📊 消费记录查询成功\n\n`;
|
|
969
|
+
summary += `📋 共找到 ${total} 条记录\n`;
|
|
970
|
+
|
|
971
|
+
// 高频商家
|
|
972
|
+
if (patterns.highFrequencyStores && patterns.highFrequencyStores.length > 0) {
|
|
973
|
+
const topStore = patterns.highFrequencyStores[0];
|
|
974
|
+
summary += `🏪 高频商家:${topStore.store}(${topStore.count}次,均价¥${topStore.avgAmount})\n`;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
// 消费时间模式
|
|
978
|
+
if (patterns.timePattern) {
|
|
979
|
+
summary += `⏰ 消费高峰:${patterns.timePattern.peakTime}\n`;
|
|
980
|
+
if (patterns.timePattern.lateNightCount > 0) {
|
|
981
|
+
summary += `🌙 深夜消费:${patterns.timePattern.lateNightCount}次\n`;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// 异常消费
|
|
986
|
+
if (patterns.unusualItems && patterns.unusualItems.length > 0) {
|
|
987
|
+
const topUnusual = patterns.unusualItems[0];
|
|
988
|
+
summary += `💡 大额消费:${topUnusual.name} ¥${topUnusual.amount}\n`;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
summary += `\n💡 提示:完整数据(含每笔明细、flags标记)请查看下方 JSON 数据`;
|
|
992
|
+
|
|
993
|
+
userMessage = summary;
|
|
964
994
|
}
|
|
965
995
|
break;
|
|
966
996
|
}
|
|
@@ -971,7 +1001,44 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
971
1001
|
result = await callMcpHub(toolName, mcpParams, token);
|
|
972
1002
|
|
|
973
1003
|
if (result.success) {
|
|
974
|
-
|
|
1004
|
+
const data = result.data || {};
|
|
1005
|
+
|
|
1006
|
+
// 构建友好的统计摘要
|
|
1007
|
+
let summary = `📈 统计查询成功\n\n`;
|
|
1008
|
+
summary += `📅 周期:${data.periodDisplay || data.period || '未知'}\n`;
|
|
1009
|
+
summary += `💰 总支出:¥${data.totalAmount || 0}(${data.totalCount || 0}笔)\n`;
|
|
1010
|
+
|
|
1011
|
+
// 环比对比
|
|
1012
|
+
if (data.compare && data.compare.vsLastPeriod !== undefined) {
|
|
1013
|
+
const change = data.compare.vsLastPeriod;
|
|
1014
|
+
const emoji = change > 0 ? '📈' : change < 0 ? '📉' : '➡️';
|
|
1015
|
+
summary += `${emoji} 环比:${change > 0 ? '+' : ''}${change}%\n`;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
// 预算进度
|
|
1019
|
+
if (data.budget) {
|
|
1020
|
+
summary += `🎯 预算:已用¥${data.budget.used}/¥${data.budget.total}(${data.budget.progress}%)\n`;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
// Top 3 分类
|
|
1024
|
+
if (data.categories && data.categories.length > 0) {
|
|
1025
|
+
summary += `\n📂 消费分类 Top3:\n`;
|
|
1026
|
+
data.categories.slice(0, 3).forEach((cat, idx) => {
|
|
1027
|
+
summary += ` ${idx + 1}. ${cat.category}:¥${cat.amount}(${cat.percentage}%)\n`;
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// 洞察摘要
|
|
1032
|
+
if (data.insights && data.insights.length > 0) {
|
|
1033
|
+
summary += `\n💡 洞察线索(${data.insights.length}条):\n`;
|
|
1034
|
+
data.insights.slice(0, 3).forEach(insight => {
|
|
1035
|
+
summary += ` ${insight.emoji || '•'} ${insight.title}:${insight.message}\n`;
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
summary += `\n💡 提示:完整数据(含每日统计、所有洞察)请查看下方 JSON 数据`;
|
|
1040
|
+
|
|
1041
|
+
userMessage = summary;
|
|
975
1042
|
}
|
|
976
1043
|
break;
|
|
977
1044
|
}
|
|
@@ -982,8 +1049,42 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
982
1049
|
result = await callMcpHub(toolName, mcpParams, token);
|
|
983
1050
|
|
|
984
1051
|
if (result.success) {
|
|
985
|
-
const
|
|
986
|
-
|
|
1052
|
+
const data = result.data || {};
|
|
1053
|
+
const insights = data.insights || [];
|
|
1054
|
+
|
|
1055
|
+
// 构建友好的洞察摘要
|
|
1056
|
+
let summary = `🔍 消费洞察获取成功\n\n`;
|
|
1057
|
+
summary += `📅 周期:${data.periodDisplay || data.period || '未知'}\n`;
|
|
1058
|
+
summary += `💡 共找到 ${insights.length} 条洞察线索\n`;
|
|
1059
|
+
|
|
1060
|
+
if (insights.length > 0) {
|
|
1061
|
+
// 按优先级分组
|
|
1062
|
+
const highPriority = insights.filter(i => i.priority === 'high');
|
|
1063
|
+
const mediumPriority = insights.filter(i => i.priority === 'medium');
|
|
1064
|
+
const lowPriority = insights.filter(i => i.priority === 'low');
|
|
1065
|
+
|
|
1066
|
+
if (highPriority.length > 0) {
|
|
1067
|
+
summary += `\n🔴 高优先级(${highPriority.length}条):\n`;
|
|
1068
|
+
highPriority.forEach(insight => {
|
|
1069
|
+
summary += ` ${insight.emoji || '•'} ${insight.title}:${insight.message}\n`;
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
if (mediumPriority.length > 0) {
|
|
1074
|
+
summary += `\n🟡 中优先级(${mediumPriority.length}条):\n`;
|
|
1075
|
+
mediumPriority.slice(0, 2).forEach(insight => {
|
|
1076
|
+
summary += ` ${insight.emoji || '•'} ${insight.title}:${insight.message}\n`;
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
if (lowPriority.length > 0) {
|
|
1081
|
+
summary += `\n🟢 低优先级(${lowPriority.length}条)\n`;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
summary += `\n💡 提示:每条洞察都包含 suggestionForAgent 字段,可用于深度分析`;
|
|
1086
|
+
|
|
1087
|
+
userMessage = summary;
|
|
987
1088
|
}
|
|
988
1089
|
break;
|
|
989
1090
|
}
|
|
@@ -994,9 +1095,20 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
994
1095
|
result = await callMcpHub(toolName, mcpParams, token);
|
|
995
1096
|
|
|
996
1097
|
if (result.success) {
|
|
997
|
-
const
|
|
998
|
-
const
|
|
999
|
-
|
|
1098
|
+
const summary = result.data?.summary || {};
|
|
1099
|
+
const totalRecords = summary.totalRecords || 0;
|
|
1100
|
+
const totalAmount = summary.totalAmount || 0;
|
|
1101
|
+
const periodDisplay = result.data?.periodDisplay || '';
|
|
1102
|
+
|
|
1103
|
+
let summaryText = `📦 数据导出完成\n\n`;
|
|
1104
|
+
if (periodDisplay) {
|
|
1105
|
+
summaryText += `📅 周期:${periodDisplay}\n`;
|
|
1106
|
+
}
|
|
1107
|
+
summaryText += `📊 导出记录数:${totalRecords}条\n`;
|
|
1108
|
+
summaryText += `💰 总金额:¥${totalAmount.toFixed ? totalAmount.toFixed(2) : totalAmount}\n`;
|
|
1109
|
+
summaryText += `\n✅ 完整数据已准备好,你可以使用自己的大模型进行深度分析了!\n(完整数据在下方的完整数据JSON中)`;
|
|
1110
|
+
|
|
1111
|
+
userMessage = summaryText;
|
|
1000
1112
|
}
|
|
1001
1113
|
break;
|
|
1002
1114
|
}
|
|
@@ -1129,13 +1241,18 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1129
1241
|
userMessage = `❌ 操作失败:${result.error || '未知错误'}`;
|
|
1130
1242
|
}
|
|
1131
1243
|
|
|
1132
|
-
userMessage
|
|
1244
|
+
// 构建完整的返回内容:userMessage + 完整的 result 数据
|
|
1245
|
+
const fullResponse = {
|
|
1246
|
+
userMessage: userMessage,
|
|
1247
|
+
result: result,
|
|
1248
|
+
mcp_version: MCP_VERSION
|
|
1249
|
+
};
|
|
1133
1250
|
|
|
1134
1251
|
return {
|
|
1135
1252
|
content: [
|
|
1136
1253
|
{
|
|
1137
1254
|
type: 'text',
|
|
1138
|
-
text: userMessage,
|
|
1255
|
+
text: `${userMessage}\n\n---\n📦 柴米记账 MCP v${MCP_VERSION}\n\n## 完整数据\n\`\`\`json\n${JSON.stringify(result, null, 2)}\n\`\`\``,
|
|
1139
1256
|
},
|
|
1140
1257
|
],
|
|
1141
1258
|
};
|