@cloudbase/cloudbase-mcp 1.8.7 → 1.8.8

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/dist/cli.cjs CHANGED
@@ -5285,6 +5285,13 @@ var KnowledgeBaseIdMap = {
5285
5285
  scf: "scfsczskzyws_4bdc",
5286
5286
  miniprogram: "xcxzskws_25d8"
5287
5287
  };
5288
+ function safeParse(str) {
5289
+ try {
5290
+ return JSON.parse(str);
5291
+ } catch (e) {
5292
+ return {};
5293
+ }
5294
+ }
5288
5295
  function safeStringify(obj) {
5289
5296
  const seen = /* @__PURE__ */ new WeakSet();
5290
5297
  try {
@@ -5370,23 +5377,23 @@ function registerRagTools(server2) {
5370
5377
  if (result.code) {
5371
5378
  throw new Error(result.message);
5372
5379
  }
5373
- const filteredResults = result.data.documents.filter((item) => item.score >= threshold);
5374
5380
  return {
5375
- content: [
5376
- {
5377
- type: "text",
5378
- text: JSON.stringify({
5379
- success: true,
5380
- total: filteredResults.length,
5381
- threshold,
5382
- results: filteredResults.map((item) => ({
5383
- content: item.content,
5381
+ content: [{
5382
+ type: "text",
5383
+ text: safeStringify(
5384
+ result.data.documents.filter((item) => item.score >= threshold).map((item) => {
5385
+ return {
5384
5386
  score: item.score,
5385
- metadata: item.metadata || {}
5386
- }))
5387
- }, null, 2)
5388
- }
5389
- ]
5387
+ fileTile: item.documentSet.fileTitle,
5388
+ url: safeParse(item.documentSet.fileMetaData).url,
5389
+ paragraphTitle: item.data.paragraphTitle,
5390
+ text: `${item.data.pre?.join("\n") || ""}
5391
+ ${item.data.text}
5392
+ ${item.data.next?.join("\n") || ""}`
5393
+ };
5394
+ })
5395
+ )
5396
+ }]
5390
5397
  };
5391
5398
  }
5392
5399
  );