@productbrain/mcp 0.0.1-beta.4849 → 0.0.1-beta.4869

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.
@@ -42,7 +42,7 @@ import {
42
42
  trackSessionCaptureRate,
43
43
  trackWriteBackHintServed,
44
44
  trackZeroCaptureAuditFired
45
- } from "./chunk-42YIJFZI.js";
45
+ } from "./chunk-Q6JFCKKI.js";
46
46
 
47
47
  // src/server.ts
48
48
  import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -397,7 +397,14 @@ var TOOL_NAME_MIGRATIONS = /* @__PURE__ */ new Map([
397
397
  ["gather-context", 'context action="gather"'],
398
398
  ["get-build-context", 'context action="build"'],
399
399
  ["list-collections", 'collections action="list"'],
400
- ["create-collection", 'collections action="create"'],
400
+ // WP-691 S4 (TASK-126, review round 1): 'collections action="create"' is gone — the member
401
+ // collection-create door closed for every caller. This row is a NOTICE, not an executable
402
+ // replacement: `collections action="update"` only edits an EXISTING collection, so mapping
403
+ // create-collection's genuine create-intent onto it would coach the agent to call a command
404
+ // that cannot do what it asked for. translateStaleToolNames renders a non-tool-call value
405
+ // (detected by its shape — no bare `noun action="value"` form) as prose, never as `\`old\` →
406
+ // \`current\`` — see its isExecutableReference check.
407
+ ["create-collection", 'closed \u2014 member collection-create is refused for every caller; ask a platform admin to provision it, or enable the module ontology pack that owns the drawer. `collections action="update"` only edits an EXISTING collection.'],
401
408
  ["update-collection", 'collections action="update"'],
402
409
  ["agent-start", 'session action="start"'],
403
410
  ["agent-close", 'session action="close"'],
@@ -439,12 +446,17 @@ var TOOL_NAME_MIGRATIONS = /* @__PURE__ */ new Map([
439
446
  ["chain-version", 'chain action="version.*" (commit/list/diff/revert/history \u2192 version.<same>)'],
440
447
  ["chain-branch", 'chain-review action="branch.*" (create/list/merge/conflicts \u2192 branch.<same>)']
441
448
  ]);
449
+ function isExecutableReference(value) {
450
+ return /^[\w./-]+(\s+action="[^"]*")?$/.test(value);
451
+ }
442
452
  function translateStaleToolNames(text) {
443
453
  const found = [];
444
454
  for (const [old, current] of TOOL_NAME_MIGRATIONS) {
445
455
  const pattern = new RegExp(`\\b${old.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`, "g");
446
456
  if (pattern.test(text)) {
447
- found.push(`\`${old}\` \u2192 \`${current}\``);
457
+ found.push(
458
+ isExecutableReference(current) ? `\`${old}\` \u2192 \`${current}\`` : `\`${old}\` \u2014 ${current}`
459
+ );
448
460
  }
449
461
  }
450
462
  if (found.length === 0) return null;
@@ -7330,7 +7342,6 @@ async function handleLabelsRemove(slug, entryId) {
7330
7342
  // src/tools/collections.ts
7331
7343
  var COLLECTIONS_ACTIONS = [
7332
7344
  "list",
7333
- "create",
7334
7345
  "update",
7335
7346
  "describe",
7336
7347
  "audit",
@@ -7374,7 +7385,7 @@ var fieldSchema = z16.object({
7374
7385
  });
7375
7386
  var collectionsSchema = z16.object({
7376
7387
  action: z16.enum(COLLECTIONS_ACTIONS).describe(
7377
- "'list': browse all collections. 'create': create a new collection. 'update': update an existing collection. 'describe': full documentation for one collection \u2014 fields, option guides, usage guidance, examples. 'audit': health report for all collections \u2014 missing classification, icon, displayHint coverage, and field schema gaps. 'export': full system_collection_definitions export with classification metadata (thinkingLayer, classificationPriority, classificationCheck, classificationSignals, governanceRole, governanceFunction, timelineRole, canBeElementOf, descriptionFieldKey). Admin only. 'label-list'/'label-create'/'label-update'/'label-delete'/'label-apply'/'label-remove': manage workspace labels (absorbs the `labels` tool)."
7388
+ "'list': browse all collections. 'update': update an existing collection. 'describe': full documentation for one collection \u2014 fields, option guides, usage guidance, examples. 'audit': health report for all collections \u2014 missing classification, icon, displayHint coverage, and field schema gaps. 'export': full system_collection_definitions export with classification metadata (thinkingLayer, classificationPriority, classificationCheck, classificationSignals, governanceRole, governanceFunction, timelineRole, canBeElementOf, descriptionFieldKey). Admin only. 'label-list'/'label-create'/'label-update'/'label-delete'/'label-apply'/'label-remove': manage workspace labels (absorbs the `labels` tool). Creating a new collection is not offered here \u2014 ask a platform admin to provision it, or enable the module ontology pack that owns the drawer."
7378
7389
  ),
7379
7390
  slug: z16.string().max(200).optional().describe("URL-safe identifier for create/update, e.g. 'glossary', 'tech-debt'. For label-*: label slug."),
7380
7391
  name: z16.string().max(500).optional().describe("Display name for create, or new name for update. For label-create: label display name."),
@@ -7408,24 +7419,6 @@ var collectionsSchema = z16.object({
7408
7419
  });
7409
7420
  var collectionsListVariant = z16.object({ action: z16.literal("list") });
7410
7421
  var collectionsDescribeVariant = z16.object({ action: z16.literal("describe"), slug: z16.string().max(200) });
7411
- var collectionsCreateVariant = z16.object({
7412
- action: z16.literal("create"),
7413
- slug: z16.string().max(200),
7414
- name: z16.string().max(500),
7415
- description: z16.string().max(2e4).optional(),
7416
- purpose: z16.string().max(2e3).optional(),
7417
- icon: z16.string().max(50).optional(),
7418
- navGroup: z16.enum(["daily", "strategic", "governance", "reference", "collections"]).optional(),
7419
- fields: z16.array(fieldSchema).min(1),
7420
- axis: z16.enum(["work", "none", "pending"]),
7421
- // required, mirrors the Convex door's axisValidator (PRRT_kwDORS4ils6ZiYjo)
7422
- stageLabelMap: z16.record(z16.string(), z16.enum(["open", "in_progress", "done", "stopped", "tag"])).optional(),
7423
- defaultCanonicalKey: z16.string().max(200).optional(),
7424
- defaultWorkflowStatus: z16.string().max(200).optional(),
7425
- validWorkflowStatuses: z16.array(z16.string().max(200)).optional(),
7426
- classificationCheck: z16.string().max(500).optional(),
7427
- classificationPriority: z16.number().optional()
7428
- });
7429
7422
  var collectionsUpdateVariant = z16.object({
7430
7423
  action: z16.literal("update"),
7431
7424
  slug: z16.string().max(200),
@@ -7474,7 +7467,6 @@ var collectionsLabelRemoveVariant = z16.object({ action: z16.literal("label-remo
7474
7467
  var collectionsActionUnion = z16.discriminatedUnion("action", [
7475
7468
  collectionsListVariant,
7476
7469
  collectionsDescribeVariant,
7477
- collectionsCreateVariant,
7478
7470
  collectionsUpdateVariant,
7479
7471
  collectionsAuditVariant,
7480
7472
  collectionsExportVariant,
@@ -7488,7 +7480,6 @@ var collectionsActionUnion = z16.discriminatedUnion("action", [
7488
7480
  var COLLECTIONS_ACTION_SPECS = {
7489
7481
  list: { params: [], description: "Browse all collections; no params." },
7490
7482
  describe: { params: ["slug"], description: "slug is required." },
7491
- create: { params: ["slug", "name", "description", "purpose", "icon", "navGroup", "fields", "axis", "stageLabelMap", "defaultCanonicalKey", "defaultWorkflowStatus", "validWorkflowStatuses", "classificationCheck", "classificationPriority"], description: "slug, name, fields, and axis are required. axis:'work' also requires stageLabelMap + validWorkflowStatuses." },
7492
7483
  update: { params: ["slug", "name", "description", "purpose", "icon", "navGroup", "fields", "axis", "stageLabelMap", "defaultCanonicalKey", "defaultWorkflowStatus", "validWorkflowStatuses", "classificationCheck", "classificationPriority", "qualityCriteria", "usageGuidance"], description: "slug is required; at least one other field must be provided. axis/stageLabelMap are only settable on a non-system-stratum collection (the repair path for a legacy custom collection missing its axis declaration)." },
7493
7484
  audit: { params: [], description: "Health report for all collections; no params." },
7494
7485
  export: { params: [], description: "Full system_collection_definitions export; no params. Admin only." },
@@ -7503,16 +7494,6 @@ function registerCollectionsTools(server) {
7503
7494
  const collectionsHandlers = {
7504
7495
  list: () => handleList2(),
7505
7496
  describe: (data) => handleDescribe(data.slug),
7506
- create: (data) => handleCreate2(
7507
- data.slug,
7508
- data.name,
7509
- data.description,
7510
- data.purpose,
7511
- data.icon,
7512
- data.navGroup ?? "collections",
7513
- data.fields,
7514
- { axis: data.axis, stageLabelMap: data.stageLabelMap, defaultCanonicalKey: data.defaultCanonicalKey, defaultWorkflowStatus: data.defaultWorkflowStatus, validWorkflowStatuses: data.validWorkflowStatuses, classificationCheck: data.classificationCheck, classificationPriority: data.classificationPriority }
7515
- ),
7516
7497
  update: (data) => {
7517
7498
  const hasChanges = data.name || data.description || data.purpose || data.icon || data.navGroup || data.fields || data.axis !== void 0 || data.stageLabelMap !== void 0 || data.defaultCanonicalKey !== void 0 || data.defaultWorkflowStatus !== void 0 || data.validWorkflowStatuses !== void 0 || data.classificationCheck !== void 0 || data.classificationPriority !== void 0 || data.qualityCriteria !== void 0 || data.usageGuidance !== void 0;
7518
7499
  if (!hasChanges) {
@@ -7542,7 +7523,7 @@ function registerCollectionsTools(server) {
7542
7523
  "collections",
7543
7524
  {
7544
7525
  title: "Collections",
7545
- description: "Manage knowledge collections and workspace labels. Twelve actions:\n\n- **list**: Browse all collections \u2014 glossary, business rules, tracking events, etc. Returns slug, name, description, and field schema. Use before capture to see what exists.\n- **describe**: Full documentation for a single collection. Returns field help text, option decision guides, usage guidance, examples, and cross-references. Use when you need to understand a collection's purpose, field semantics, or option values.\n- **create**: Create a new collection. Provide slug, name, and field schema. Use when setting up a workspace or tracking a new type of knowledge.\n- **update**: Update an existing collection's name, description, purpose, icon, navGroup, fields, or (non-system collections only) axis/stageLabelMap. Only provide the fields you want to change.\n- **audit**: Health report for all workspace collections. Checks classification metadata, icon presence, displayHint coverage per field, and field schema gaps vs system definitions. Returns total collections, count with issues, and per-collection issue list.\n- **export**: Full system_collection_definitions export as JSON. Includes all classification metadata (thinkingLayer, classificationPriority, classificationCheck, timelineRole, governanceRole, governanceFunction, etc.). Admin only.\n- **label-list/label-create/label-update/label-delete/label-apply/label-remove**: manage workspace labels (absorbs the `labels` tool) \u2014 list all labels, create/update/delete a label, or apply/remove a label on an entry. Labels can be applied to any entry across any collection for cross-domain filtering.",
7526
+ description: "Manage knowledge collections and workspace labels. Eleven actions:\n\n- **list**: Browse all collections \u2014 glossary, business rules, tracking events, etc. Returns slug, name, description, and field schema. Use before capture to see what exists.\n- **describe**: Full documentation for a single collection. Returns field help text, option decision guides, usage guidance, examples, and cross-references. Use when you need to understand a collection's purpose, field semantics, or option values.\n- **update**: Update an existing collection's name, description, purpose, icon, navGroup, fields, or (non-system collections only) axis/stageLabelMap. Only provide the fields you want to change. Creating a NEW collection is not offered here \u2014 ask a platform admin to provision it, or enable the module ontology pack that owns the drawer.\n- **audit**: Health report for all workspace collections. Checks classification metadata, icon presence, displayHint coverage per field, and field schema gaps vs system definitions. Returns total collections, count with issues, and per-collection issue list.\n- **export**: Full system_collection_definitions export as JSON. Includes all classification metadata (thinkingLayer, classificationPriority, classificationCheck, timelineRole, governanceRole, governanceFunction, etc.). Admin only.\n- **label-list/label-create/label-update/label-delete/label-apply/label-remove**: manage workspace labels (absorbs the `labels` tool) \u2014 list all labels, create/update/delete a label, or apply/remove a label on an entry. Labels can be applied to any entry across any collection for cross-domain filtering.",
7546
7527
  inputSchema: collectionsSchema,
7547
7528
  annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
7548
7529
  },
@@ -7667,8 +7648,7 @@ async function handleList2() {
7667
7648
  return successResult(
7668
7649
  "No collections found in this workspace.",
7669
7650
  "No collections found yet.",
7670
- { collections: [], total: 0 },
7671
- [{ tool: "collections", description: "Create collection", parameters: { action: "create" } }]
7651
+ { collections: [], total: 0 }
7672
7652
  );
7673
7653
  }
7674
7654
  const formatted = collections.map((c) => {
@@ -7705,69 +7685,6 @@ ${formatted}` }],
7705
7685
  function metaFields(m) {
7706
7686
  return Object.fromEntries(Object.entries(m).filter(([, v]) => v !== void 0));
7707
7687
  }
7708
- async function handleCreate2(slug, name, description, purpose, icon, navGroup, fields, meta = {}) {
7709
- requireWriteAccess();
7710
- try {
7711
- await kernelMutation("chain.createCollection", {
7712
- slug,
7713
- name,
7714
- description,
7715
- purpose,
7716
- icon,
7717
- navGroup,
7718
- fields,
7719
- ...metaFields(meta),
7720
- createdBy: getAgentSessionId() ? `agent:${getAgentSessionId()}` : "mcp"
7721
- });
7722
- invalidateCollectionCacheForScope();
7723
- invalidateProfileCacheForScope();
7724
- invalidateHubCacheForScope();
7725
- const fieldList = fields.map((f) => ` - \`${f.key}\` (${f.type}${f.required ? ", required" : ""}${f.searchable ? ", searchable" : ""})`).join("\n");
7726
- return {
7727
- content: [{
7728
- type: "text",
7729
- text: `# Collection Created: ${name}
7730
-
7731
- **Slug:** \`${slug}\`
7732
- ` + (description ? `**Description:** ${description}
7733
- ` : "") + (purpose ? `**Purpose:** ${purpose}
7734
- ` : "") + `**Nav group:** ${navGroup}
7735
-
7736
- **Fields:**
7737
- ${fieldList}
7738
-
7739
- You can now capture entries: \`capture collection="${slug}" name="..." description="..."\``
7740
- }],
7741
- structuredContent: success(
7742
- `Created collection '${name}' (${slug}) with ${fields.length} fields.`,
7743
- { slug, name, description, purpose, navGroup, fieldCount: fields.length },
7744
- [{ tool: "capture", description: "Capture an entry", parameters: { collection: slug } }]
7745
- )
7746
- };
7747
- } catch (error) {
7748
- const msg = error instanceof Error ? error.message : String(error);
7749
- if (msg.includes("already exists")) {
7750
- return failureResult(
7751
- `Collection '${slug}' already exists. Use collections action=update to modify it, or choose a different slug.`,
7752
- "DUPLICATE",
7753
- `Collection '${slug}' already exists.`,
7754
- "Use collections action=update to modify it.",
7755
- [{ tool: "collections", description: "Update collection", parameters: { action: "update", slug } }]
7756
- );
7757
- }
7758
- const code = error.code ?? error.data?.code;
7759
- if (code === "COLLECTION_PREFIX_TAKEN" || msg.includes("already used by collection")) {
7760
- return failureResult(
7761
- msg,
7762
- "DUPLICATE",
7763
- msg,
7764
- "Choose a different prefix by passing the idPrefix parameter, or let the system derive one from a different slug.",
7765
- [{ tool: "collections", description: "List collections to see taken prefixes", parameters: { action: "list" } }]
7766
- );
7767
- }
7768
- throw error;
7769
- }
7770
- }
7771
7688
  async function handleUpdate(slug, name, description, purpose, icon, navGroup, fields, meta = {}) {
7772
7689
  requireWriteAccess();
7773
7690
  await kernelMutation("chain.updateCollection", {
@@ -14339,7 +14256,7 @@ var CALL_CATEGORIES = {
14339
14256
  "chain.createLabel": "label",
14340
14257
  "chain.updateLabel": "label",
14341
14258
  "chain.deleteLabel": "label",
14342
- "chain.createCollection": "write",
14259
+ // WP-691 S4 (TASK-126): 'chain.createCollection' route removed — closed for every caller.
14343
14260
  "chain.updateCollection": "write",
14344
14261
  "chain.listCollections": "meta",
14345
14262
  "chain.getCollection": "meta",
@@ -15896,7 +15813,7 @@ ${stds}`);
15896
15813
  async (uri) => {
15897
15814
  const collections = await kernelQuery("chain.listCollections") ?? [];
15898
15815
  if (collections.length === 0) {
15899
- return { contents: [{ uri: uri.href, text: "No collections in this workspace. Use `collections action=create` or `start` with a preset to get started.", mimeType: "text/markdown" }] };
15816
+ return { contents: [{ uri: uri.href, text: "No collections in this workspace. Ask a platform admin to provision one, or enable a module ontology pack \u2014 `collections action=create` is no longer self-serve.", mimeType: "text/markdown" }] };
15900
15817
  }
15901
15818
  const formatted = collections.map((c) => {
15902
15819
  const fieldList = (c.fields ?? []).map((f) => ` - \`${f.key}\` (${f.type}${f.required ? ", required" : ""}${f.searchable ? ", searchable" : ""})`).join("\n");
@@ -16409,8 +16326,9 @@ var INSTRUCTIONS = [
16409
16326
  "If the work is outside the scope of active work packages \u2014 stop, name the gap, and ask the user",
16410
16327
  "to confirm before designing. Do not propose implementation for out-of-scope work without a go-ahead.",
16411
16328
  "",
16412
- "Workspace setup: use `collections action=create` and `collections action=update` to shape the workspace",
16413
- "structure with the user. Ask what they need to track; presets are starting points, not fixed.",
16329
+ "Workspace setup: use `collections action=update` to shape existing collections with the user.",
16330
+ "Creating a brand-new collection is not self-serve \u2014 ask a platform admin to provision it, or",
16331
+ "enable the module ontology pack that owns the drawer.",
16414
16332
  "",
16415
16333
  "Personalization: if you have context about the user from memory (prior work, recent",
16416
16334
  "conversations, team context), use it to personalize recommendations. For example,",
@@ -16577,4 +16495,4 @@ export {
16577
16495
  createProductBrainServer,
16578
16496
  initFeatureFlags
16579
16497
  };
16580
- //# sourceMappingURL=chunk-U3LG62QG.js.map
16498
+ //# sourceMappingURL=chunk-EW72I5PP.js.map