chaimi-bookkeeping-mcp 2.4.0 → 2.4.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +26 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaimi-bookkeeping-mcp",
3
- "version": "2.4.0",
3
+ "version": "2.4.4",
4
4
  "description": "柴米记账 MCP Server - 支持 Claude、Cursor、OpenClaw、WorkBuddy 等 AI 工具直接记账",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -333,33 +333,43 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
333
333
  }
334
334
 
335
335
  case 'save_receipt': {
336
- const validationResult = await callMcpPrompt(
337
- 'validateResult',
338
- {
339
- data: processedArgs,
340
- type: 'parseReceipt'
341
- },
342
- token
343
- );
344
-
345
- if (validationResult.success && !validationResult.data.valid) {
346
- const fillResult = await callMcpPrompt(
347
- 'fillDefaults',
336
+ // 1. 调用 parseReceipt 重新提取小票信息(覆盖 Agent 传的数据)
337
+ if (processedArgs.rawInput) {
338
+ const parseResult = await callMcpPrompt(
339
+ 'parseReceipt',
348
340
  {
349
- data: processedArgs,
341
+ text: processedArgs.rawInput,
350
342
  type: 'parseReceipt'
351
343
  },
352
344
  token
353
345
  );
354
346
 
355
- if (fillResult.success) {
347
+ if (parseResult.success && parseResult.data) {
348
+ // 用 parseReceipt 提取的信息覆盖 Agent 传的参数
356
349
  processedArgs = {
357
- ...fillResult.data,
358
- ...processedArgs
350
+ ...processedArgs,
351
+ ...parseResult.data
359
352
  };
360
353
  }
361
354
  }
362
355
 
356
+ // 2. 调用 fillDefaults 补充默认值
357
+ const fillResult = await callMcpPrompt(
358
+ 'fillDefaults',
359
+ {
360
+ data: processedArgs,
361
+ type: 'parseReceipt'
362
+ },
363
+ token
364
+ );
365
+
366
+ if (fillResult.success) {
367
+ processedArgs = {
368
+ ...fillResult.data,
369
+ ...processedArgs
370
+ };
371
+ }
372
+
363
373
  const mcpParams = convertParams('save_receipt', processedArgs);
364
374
  result = await callMcpHub('addReceipt', mcpParams, token);
365
375