chaimi-keep-mcp 3.3.3-beta.14 → 3.3.3-beta.15
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/package.json +1 -1
- package/server.js +20 -19
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1194,10 +1194,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1194
1194
|
if (invalidItems.length > 0) {
|
|
1195
1195
|
result = {
|
|
1196
1196
|
success: false,
|
|
1197
|
-
error: `商品数据不完整:${invalidItems.join('; ')}。每个商品必须包含:name, amount, price, quantity, category`,
|
|
1197
|
+
error: `商品数据不完整:${invalidItems.join('; ')}。每个商品必须包含:name, amount, price, quantity, productCategory, category`,
|
|
1198
1198
|
code: 400
|
|
1199
1199
|
};
|
|
1200
|
-
userMessage = `❌ 保存失败\n\n错误:商品数据格式不完整\n\n${invalidItems.join('\n')}\n\n💡 解决方案:\n1. 请更新您的柴米AI记账 MCP Skill\n2. 确保每个商品包含完整的
|
|
1200
|
+
userMessage = `❌ 保存失败\n\n错误:商品数据格式不完整\n\n${invalidItems.join('\n')}\n\n💡 解决方案:\n1. 请更新您的柴米AI记账 MCP Skill\n2. 确保每个商品包含完整的6个字段:name, amount, price, quantity, productCategory, category\n3. productCategory 是商品分类,category 是记账分类,都是必填项`;
|
|
1201
1201
|
break;
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
@@ -2117,6 +2117,8 @@ function convertParams(toolName, args) {
|
|
|
2117
2117
|
amount: amount,
|
|
2118
2118
|
price: amount,
|
|
2119
2119
|
quantity: 1,
|
|
2120
|
+
productCategory: sanitizeString(args.productCategory, 50) || '其他',
|
|
2121
|
+
productSubCategory: sanitizeString(args.productSubCategory, 50) || '',
|
|
2120
2122
|
category: sanitizeString(args.category, 50) || '其他',
|
|
2121
2123
|
unit: sanitizeString(args.unit, 20) || '',
|
|
2122
2124
|
weight: '',
|
|
@@ -2154,22 +2156,21 @@ function convertParams(toolName, args) {
|
|
|
2154
2156
|
const marketPrice = sanitizeString(item.marketPrice, 50) || calculateMarketPrice(amount, weight);
|
|
2155
2157
|
|
|
2156
2158
|
return {
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
};
|
|
2159
|
+
itemIndex: index,
|
|
2160
|
+
name: sanitizeString(item.name, 100),
|
|
2161
|
+
originalName: sanitizeString(item.originalName, 200) || sanitizeString(item.name, 100),
|
|
2162
|
+
amount: amount,
|
|
2163
|
+
productCategory: sanitizeString(item.productCategory, 50) || '其他',
|
|
2164
|
+
productSubCategory: sanitizeString(item.productSubCategory, 50) || '',
|
|
2165
|
+
category: sanitizeString(item.category, 50) || '其他',
|
|
2166
|
+
transactionType: sanitizeString(item.transactionType, 50) || 'expense',
|
|
2167
|
+
price: validateAmount(item.price),
|
|
2168
|
+
quantity: item.quantity ? String(item.quantity).substring(0, 20) : '1',
|
|
2169
|
+
unit: sanitizeString(item.unit, 20),
|
|
2170
|
+
weight: weight,
|
|
2171
|
+
marketPrice: marketPrice,
|
|
2172
|
+
note: sanitizeString(item.note, 500),
|
|
2173
|
+
};
|
|
2173
2174
|
}),
|
|
2174
2175
|
store: sanitizeString(args.store, 100),
|
|
2175
2176
|
receiptNo: sanitizeString(args.receiptNo, 50),
|
|
@@ -2193,7 +2194,7 @@ function convertParams(toolName, args) {
|
|
|
2193
2194
|
};
|
|
2194
2195
|
}
|
|
2195
2196
|
|
|
2196
|
-
case '
|
|
2197
|
+
case 'get_expenses': {
|
|
2197
2198
|
// 【新增】支持 period 参数
|
|
2198
2199
|
const periodDates = args.period ? parsePeriod(args.period) : {};
|
|
2199
2200
|
return {
|