@productbrain/mcp 0.0.1-beta.7007 → 0.0.1-beta.7018

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.
@@ -4054,7 +4054,7 @@ async function handleGet(entryId) {
4054
4054
  const entryData = {
4055
4055
  entryId: String(e.entryId ?? ""),
4056
4056
  name: String(e.name ?? ""),
4057
- collection: String(e.canonicalKey ?? ""),
4057
+ collection: String(e.collectionSlug ?? ""),
4058
4058
  status: String(e.status ?? ""),
4059
4059
  ...typeof e.capturedAt === "number" ? { capturedAt: e.capturedAt } : {},
4060
4060
  ...e.workflowStatus ? { workflowStatus: String(e.workflowStatus) } : {},
@@ -4074,7 +4074,7 @@ async function handleGet(entryId) {
4074
4074
  // TEN-2191: surface the WHY and its quality in the structured payload too.
4075
4075
  ...why.length > 0 ? { why } : {},
4076
4076
  ...e.whyQuality ? { whyQuality: String(e.whyQuality) } : {},
4077
- entries: [{ entryId: e.entryId, name: e.name, status: e.status, ...e.workflowStatus ? { workflowStatus: e.workflowStatus } : {}, collectionName: String(e.collectionName ?? e.canonicalKey ?? "\u2014") }],
4077
+ entries: [{ entryId: e.entryId, name: e.name, status: e.status, ...e.workflowStatus ? { workflowStatus: e.workflowStatus } : {}, collectionName: String(e.collectionSlug ?? e.collectionName ?? "\u2014") }],
4078
4078
  // Structured payload uses the same filteredData as the text render — the
4079
4079
  // WHY-source field (rationale or description) is intentionally omitted from
4080
4080
  // `data` because its full value is carried in the top-level `why` field
@@ -4088,7 +4088,7 @@ async function handleGet(entryId) {
4088
4088
  return {
4089
4089
  content: [{ type: "text", text: lines.join("\n") }],
4090
4090
  structuredContent: success(
4091
- `Found ${entryId}: ${String(e.name)} [${String(e.canonicalKey ?? "")}].`,
4091
+ `Found ${entryId}: ${String(e.name)} [${String(e.collectionSlug ?? "")}].`,
4092
4092
  entryData,
4093
4093
  [
4094
4094
  { tool: "relations", description: "Explore connections", parameters: { action: "suggest", entryId } },
@@ -4169,7 +4169,7 @@ async function handleBatch(entryIds) {
4169
4169
  return {
4170
4170
  entryId: String(entry.entryId ?? ""),
4171
4171
  name: String(entry.name ?? ""),
4172
- collection: String(entry.canonicalKey ?? ""),
4172
+ collection: String(entry.collectionSlug ?? ""),
4173
4173
  status: String(entry.status ?? ""),
4174
4174
  ...typeof entry.capturedAt === "number" ? { capturedAt: entry.capturedAt } : {},
4175
4175
  ...entry.origin ? { origin: String(entry.origin) } : {},
@@ -4195,6 +4195,9 @@ async function handleBatch(entryIds) {
4195
4195
  structuredContent: success(`Fetched ${total} entries in batch.`, { entries: structuredEntries, total })
4196
4196
  };
4197
4197
  }
4198
+ function buildCollectionSlugMap(collections) {
4199
+ return new Map(collections.map((c) => [c._id, c.slug]));
4200
+ }
4198
4201
  async function handleList(collection, status2, tag, label) {
4199
4202
  let entries;
4200
4203
  if (label) {
@@ -4232,7 +4235,7 @@ ${dataPreview}` : ""}`;
4232
4235
  const structuredEntries = entries.map((e) => ({
4233
4236
  entryId: String(e.entryId ?? ""),
4234
4237
  name: String(e.name ?? ""),
4235
- collection: String(e.canonicalKey ?? collection ?? ""),
4238
+ collection: String(e.collectionSlug ?? ""),
4236
4239
  status: String(e.status ?? ""),
4237
4240
  ...e.workflowStatus ? { workflowStatus: e.workflowStatus } : {}
4238
4241
  }));
@@ -4278,22 +4281,18 @@ async function handleSearch(server, query, collection, status2) {
4278
4281
  )
4279
4282
  };
4280
4283
  }
4281
- const collMap = /* @__PURE__ */ new Map();
4282
- for (const c of collections) {
4283
- collMap.set(c._id, { name: c.name, slug: c.slug });
4284
- }
4284
+ const collMap = buildCollectionSlugMap(collections);
4285
4285
  const countsBySlug = /* @__PURE__ */ new Map();
4286
4286
  for (const e of results) {
4287
- const col = collMap.get(e.collectionId);
4288
- const slug = col?.slug ?? "unknown";
4287
+ const slug = collMap.get(e.collectionId) ?? "unknown";
4289
4288
  countsBySlug.set(slug, (countsBySlug.get(slug) ?? 0) + 1);
4290
4289
  }
4291
4290
  const collSummary = [...countsBySlug.entries()].sort((a, b) => b[1] - a[1]).map(([slug, count]) => `${count} ${slug}`).join(", ");
4292
4291
  const formatted = results.map((e) => {
4293
4292
  const id = e.entryId ? `**${e.entryId}:** ` : "";
4294
4293
  const statusDisplay = e.workflowStatus ? `${e.status} / ${e.workflowStatus}` : e.status;
4295
- const col = collMap.get(e.collectionId ?? "");
4296
- const colTag = col ? ` [${col.slug}]` : "";
4294
+ const slug = collMap.get(e.collectionId ?? "");
4295
+ const colTag = slug ? ` [${slug}]` : "";
4297
4296
  const typeTag = e.canonicalKey ? ` (${e.canonicalKey})` : "";
4298
4297
  const desc = extractPreview(e.data, 150);
4299
4298
  const preview = desc ? `
@@ -4309,7 +4308,7 @@ async function handleSearch(server, query, collection, status2) {
4309
4308
  const structuredResults = results.map((e) => ({
4310
4309
  entryId: String(e.entryId ?? ""),
4311
4310
  name: String(e.name ?? ""),
4312
- collection: collMap.get(e.collectionId ?? "")?.slug ?? "unknown",
4311
+ collection: collMap.get(e.collectionId ?? "") ?? "unknown",
4313
4312
  status: String(e.status ?? ""),
4314
4313
  ...e.workflowStatus ? { workflowStatus: e.workflowStatus } : {},
4315
4314
  ...e.score != null ? { score: e.score } : {}
@@ -13895,7 +13894,8 @@ var ROLE_ACTION_SPECS = {
13895
13894
  function formatRow(row) {
13896
13895
  const id = row.entryId ?? row.id;
13897
13896
  const statusDisplay = row.workflowStatus ? `${row.status} / ${sanitizeSingleLineField(row.workflowStatus)}` : row.status;
13898
- return ` ${id} ${sanitizeSingleLineField(row.name)} [${row.canonicalKey ?? "?"}/${statusDisplay}]`;
13897
+ const collectionSlug = row.collectionSlug ? sanitizeSingleLineField(row.collectionSlug) : "?";
13898
+ return ` ${id} ${sanitizeSingleLineField(row.name)} [${collectionSlug}/${statusDisplay}]`;
13899
13899
  }
13900
13900
  function formatSection(label, rows, truncated, cursorHint) {
13901
13901
  if (rows.length === 0 && !truncated) return [` ${label}: not recorded yet`];
@@ -15007,4 +15007,4 @@ export {
15007
15007
  createProductBrainServer,
15008
15008
  initFeatureFlags
15009
15009
  };
15010
- //# sourceMappingURL=chunk-VLFS2NQ2.js.map
15010
+ //# sourceMappingURL=chunk-MY6MRCJ6.js.map