chaimi-bookkeeping-mcp 2.4.4 → 3.0.0
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 +34 -0
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -190,6 +190,16 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
190
190
|
required: ['name', 'amount'],
|
|
191
191
|
},
|
|
192
192
|
},
|
|
193
|
+
{
|
|
194
|
+
name: 'get_parse_prompt',
|
|
195
|
+
description: '获取小票图片解析的Prompt模板,用于指导大模型如何格式化输出小票信息。返回的Prompt应作为system message,配合小票图片作为user message调用大模型',
|
|
196
|
+
inputSchema: {
|
|
197
|
+
type: 'object',
|
|
198
|
+
properties: {
|
|
199
|
+
type: { type: 'string', description: 'Prompt类型,如:parseReceipt', default: 'parseReceipt' },
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
193
203
|
],
|
|
194
204
|
};
|
|
195
205
|
});
|
|
@@ -424,6 +434,30 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
424
434
|
break;
|
|
425
435
|
}
|
|
426
436
|
|
|
437
|
+
case 'get_parse_prompt': {
|
|
438
|
+
const promptType = args.type || 'parseReceipt';
|
|
439
|
+
const promptResult = await callMcpPrompt('getPrompt', { type: promptType }, token);
|
|
440
|
+
|
|
441
|
+
if (promptResult.success) {
|
|
442
|
+
result = {
|
|
443
|
+
success: true,
|
|
444
|
+
data: {
|
|
445
|
+
type: promptType,
|
|
446
|
+
version: promptResult.data.version,
|
|
447
|
+
systemPrompt: promptResult.data.systemPrompt,
|
|
448
|
+
userPromptTemplate: promptResult.data.userPromptTemplate,
|
|
449
|
+
examples: promptResult.data.examples,
|
|
450
|
+
instructions: '请将 systemPrompt 作为 system message,把小票图片作为 user message,调用你的大模型进行解析。解析完成后,调用 save_receipt 工具保存结果。'
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
userMessage = `✅ 获取解析Prompt成功\n\n版本: ${promptResult.data.version}\n\n请使用 systemPrompt 指导大模型解析小票图片,然后调用 save_receipt 保存结果。`;
|
|
454
|
+
} else {
|
|
455
|
+
result = { success: false, error: promptResult.error };
|
|
456
|
+
userMessage = `❌ 获取Prompt失败:${promptResult.error}`;
|
|
457
|
+
}
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
|
|
427
461
|
default:
|
|
428
462
|
throw new Error(`未知工具: ${name}`);
|
|
429
463
|
}
|