@productbrain/mcp 0.0.1-beta.9193 → 0.0.1-beta.9201
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.
|
@@ -3329,6 +3329,35 @@ ${recovery}`,
|
|
|
3329
3329
|
}
|
|
3330
3330
|
}
|
|
3331
3331
|
|
|
3332
|
+
// src/lib/platformGlossary.ts
|
|
3333
|
+
var PLATFORM_GLOSSARY_TERMS = [
|
|
3334
|
+
{ name: "Team", definition: "A group of people and agents working toward one purpose; its roles own its decisions, rules and work." },
|
|
3335
|
+
{ name: "Team Lead", definition: "The role accountable for a team's purpose; it decides anything that belongs to a role nobody holds." },
|
|
3336
|
+
{ name: "Role", definition: "A named set of responsibilities a person holds; whoever sits in it decides and accepts the entries it owns." },
|
|
3337
|
+
{ name: "Tension", definition: "A gap someone notices between how things are and how they should be; linking one to an entry is how you say you disagree with it." }
|
|
3338
|
+
];
|
|
3339
|
+
function matchPlatformGlossaryTerms(query) {
|
|
3340
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
3341
|
+
if (query.trim().length < 2 || words.length === 0) return [];
|
|
3342
|
+
return PLATFORM_GLOSSARY_TERMS.filter((term) => {
|
|
3343
|
+
const name = term.name.toLowerCase();
|
|
3344
|
+
return words.every((word) => name.includes(word));
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
// src/tools/platformGlossarySearch.ts
|
|
3349
|
+
function platformGlossarySearch(query, collection, status2) {
|
|
3350
|
+
const statusFiltered = Array.isArray(status2) ? status2.length > 0 : !!status2;
|
|
3351
|
+
const terms = !statusFiltered && (!collection || collection === "glossary") ? matchPlatformGlossaryTerms(query) : [];
|
|
3352
|
+
return {
|
|
3353
|
+
count: terms.length,
|
|
3354
|
+
lines: terms.map((t) => `- **${t.name}** (platform term) [glossary]
|
|
3355
|
+
${t.definition}`),
|
|
3356
|
+
structured: terms.map((t) => ({ entryId: null, name: t.name, collection: "glossary", definition: t.definition })),
|
|
3357
|
+
summaryLabel: terms.length ? `${terms.length} platform glossary` : ""
|
|
3358
|
+
};
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3332
3361
|
// src/tools/entriesContract.ts
|
|
3333
3362
|
import { z as z10 } from "zod/v3";
|
|
3334
3363
|
var ENTRIES_ACTIONS = [
|
|
@@ -3910,7 +3939,9 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3910
3939
|
kernelQuery("chain.searchEntries", { query, collectionSlug: collection, status: status2 }),
|
|
3911
3940
|
kernelQuery("chain.listCollections")
|
|
3912
3941
|
]);
|
|
3913
|
-
|
|
3942
|
+
const platform = platformGlossarySearch(query, collection, status2);
|
|
3943
|
+
const matches = results.length + platform.count;
|
|
3944
|
+
if (matches === 0) {
|
|
3914
3945
|
const recorded = recordGap({ query, tool: "entries", action: "search", gapType: "search_zero", collectionScope: collection });
|
|
3915
3946
|
if (recorded) {
|
|
3916
3947
|
getWorkspaceId().then((wsId) => trackKnowledgeGap(wsId, { query, tool: "entries", action: "search", gap_type: "search_zero", collection_scope: collection })).catch(() => {
|
|
@@ -3937,6 +3968,7 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3937
3968
|
const slug = collMap.get(e.collectionId) ?? "unknown";
|
|
3938
3969
|
countsBySlug.set(slug, (countsBySlug.get(slug) ?? 0) + 1);
|
|
3939
3970
|
}
|
|
3971
|
+
if (platform.count) countsBySlug.set("platform glossary", platform.count);
|
|
3940
3972
|
const collSummary = [...countsBySlug.entries()].sort((a, b) => b[1] - a[1]).map(([slug, count]) => `${count} ${slug}`).join(", ");
|
|
3941
3973
|
const formatted = results.map((e) => {
|
|
3942
3974
|
const id = e.entryId ? `**${e.entryId}:** ` : "";
|
|
@@ -3950,7 +3982,7 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3950
3982
|
}).join("\n");
|
|
3951
3983
|
const header = `## Search Result
|
|
3952
3984
|
|
|
3953
|
-
# Search Results for "${query}"${scope} (${
|
|
3985
|
+
# Search Results for "${query}"${scope} (${matches} match${matches === 1 ? "" : "es"})
|
|
3954
3986
|
|
|
3955
3987
|
**By collection:** ${collSummary}`;
|
|
3956
3988
|
const footer = `_Tip: Use \`collection\` param to scope search. Use entries action=get with an entry ID for full details._`;
|
|
@@ -3972,10 +4004,11 @@ async function handleSearch(server, query, collection, status2) {
|
|
|
3972
4004
|
return {
|
|
3973
4005
|
content: [{ type: "text", text: `${header}
|
|
3974
4006
|
|
|
3975
|
-
${formatted}
|
|
4007
|
+
${[...platform.lines, formatted].filter(Boolean).join("\n")}
|
|
3976
4008
|
|
|
3977
4009
|
${footer}` }],
|
|
3978
|
-
structuredContent: success(`Found ${total} entries matching '${query}'.`, {
|
|
4010
|
+
structuredContent: success(`Found ${total} entries${platform.count ? ` and ${platform.count} platform glossary terms` : ""} matching '${query}'.`, {
|
|
4011
|
+
platformTerms: platform.structured,
|
|
3979
4012
|
results: structuredResults,
|
|
3980
4013
|
entries: entriesForView,
|
|
3981
4014
|
total,
|
|
@@ -5112,8 +5145,7 @@ async function handleBuild(server, entryId, maxHops) {
|
|
|
5112
5145
|
if (glossaryTerms.length > 0) {
|
|
5113
5146
|
lines.push("## Glossary Terms");
|
|
5114
5147
|
for (const t of glossaryTerms.slice(0, 15)) {
|
|
5115
|
-
|
|
5116
|
-
lines.push(`- **${id}:** ${t.name}`);
|
|
5148
|
+
lines.push(t.platform ? `- **${t.name}** (platform term)` : `- **${t.entryId ?? t.name}:** ${t.name}`);
|
|
5117
5149
|
if (t.definition) lines.push(` ${t.definition.slice(0, 120)}${t.definition.length > 120 ? "..." : ""}`);
|
|
5118
5150
|
}
|
|
5119
5151
|
if (glossaryTerms.length > 15) lines.push(` _...and ${glossaryTerms.length - 15} more_`);
|
|
@@ -5695,13 +5727,13 @@ var fieldSchema = z17.object({
|
|
|
5695
5727
|
});
|
|
5696
5728
|
var collectionsSchema = z17.object({
|
|
5697
5729
|
action: z17.enum(COLLECTIONS_ACTIONS).describe(
|
|
5698
|
-
"'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,
|
|
5730
|
+
"'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, 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."
|
|
5699
5731
|
),
|
|
5700
5732
|
slug: z17.string().max(200).optional().describe("URL-safe identifier for create/update, e.g. 'glossary', 'tech-debt'. For label-*: label slug."),
|
|
5701
5733
|
name: z17.string().max(ENTRY_NAME_MAX_CHARS).optional().describe("Display name for create, or new name for update. For label-create: label display name."),
|
|
5702
5734
|
description: z17.string().max(2e4).optional().describe("What this collection is for. For label-create/label-update: what the label means (max 2,000 characters)."),
|
|
5703
5735
|
purpose: z17.string().max(2e3).optional().describe("Why this collection exists \u2014 strategic reason"),
|
|
5704
|
-
icon: z17.string().max(50).optional().describe("
|
|
5736
|
+
icon: z17.string().max(50).optional().describe("For update: always refused \u2014 a collection's icon comes from the platform catalog."),
|
|
5705
5737
|
navGroup: z17.enum(["daily", "strategic", "governance", "reference", "collections"]).optional().describe("Sidebar placement: 'daily', 'strategic', 'governance', 'reference', 'collections'"),
|
|
5706
5738
|
fields: z17.array(fieldSchema).max(200).optional().describe("Field definitions for create, or replacement schema for update (replaces all fields)"),
|
|
5707
5739
|
axis: z17.enum(["work", "none", "pending"]).optional().describe("REQUIRED for create: 'work' (needs stageLabelMap + validWorkflowStatuses), 'none', or 'pending'. For update: always refused \u2014 a collection's axis comes from the platform catalog."),
|
|
@@ -5829,7 +5861,7 @@ function registerCollectionsTools(server) {
|
|
|
5829
5861
|
"collections",
|
|
5830
5862
|
{
|
|
5831
5863
|
title: "Collections",
|
|
5832
|
-
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 a collection's name, description, purpose,
|
|
5864
|
+
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 a collection's name, description, purpose, navGroup, fields, or (non-system only) stageLabelMap; axis, status words and icon are the catalog's. 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, 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.",
|
|
5833
5865
|
inputSchema: collectionsSchema,
|
|
5834
5866
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
|
|
5835
5867
|
},
|
|
@@ -6044,8 +6076,7 @@ All collections are healthy.`);
|
|
|
6044
6076
|
## Collections With Issues
|
|
6045
6077
|
`);
|
|
6046
6078
|
for (const col of problematic) {
|
|
6047
|
-
|
|
6048
|
-
lines.push(`### ${icon} ${col.name} (\`${col.slug}\`) \u2014 ${col.issues.length} issue(s)`);
|
|
6079
|
+
lines.push(`### ${col.name} (\`${col.slug}\`) \u2014 ${col.issues.length} issue(s)`);
|
|
6049
6080
|
for (const issue of col.issues) {
|
|
6050
6081
|
lines.push(`- **[${issue.code}]** ${issue.message}`);
|
|
6051
6082
|
}
|
|
@@ -6057,7 +6088,7 @@ All collections are healthy.`);
|
|
|
6057
6088
|
lines.push(`
|
|
6058
6089
|
## Healthy Collections
|
|
6059
6090
|
`);
|
|
6060
|
-
lines.push(healthyCollections.map((c) => `-
|
|
6091
|
+
lines.push(healthyCollections.map((c) => `- \`${c.slug}\``).join("\n"));
|
|
6061
6092
|
}
|
|
6062
6093
|
return {
|
|
6063
6094
|
content: [{ type: "text", text: lines.join("\n") }],
|
|
@@ -13052,18 +13083,21 @@ async function buildTerminologyResourceText() {
|
|
|
13052
13083
|
kernelQuery("chain.listEntries", { collectionSlug: "standards" })
|
|
13053
13084
|
]);
|
|
13054
13085
|
const lines = ["# Product Brain \u2014 Terminology"];
|
|
13086
|
+
const platformTerms = PLATFORM_GLOSSARY_TERMS.map((t) => `- **${t.name}** (platform term): ${t.definition}`).join("\n");
|
|
13055
13087
|
if (glossaryResult.status === "fulfilled") {
|
|
13056
13088
|
const glossary = glossaryResult.value ?? [];
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
lines.push(`## Glossary (${glossary.length} terms)
|
|
13089
|
+
const teamTerms = glossary.length > 0 ? glossary.map((t) => `- **${t.name}** (${t.entryId ?? "\u2014"}) [${t.status}]: ${readEntryBody(t.data, "canonical") ?? readEntryBody(t.data, "description") ?? ""}`).join("\n") : "This team has no terms of its own yet. Use `capture` with collection `glossary` to add one.";
|
|
13090
|
+
lines.push(`## Glossary (${PLATFORM_GLOSSARY_TERMS.length} platform terms, ${glossary.length} of this team's)
|
|
13060
13091
|
|
|
13061
|
-
${
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
}
|
|
13092
|
+
${platformTerms}
|
|
13093
|
+
|
|
13094
|
+
${teamTerms}`);
|
|
13065
13095
|
} else {
|
|
13066
|
-
lines.push(
|
|
13096
|
+
lines.push(`## Glossary
|
|
13097
|
+
|
|
13098
|
+
${platformTerms}
|
|
13099
|
+
|
|
13100
|
+
Could not load this team's terms \u2014 use \`entries action=list collection=glossary\` to browse manually.`);
|
|
13067
13101
|
}
|
|
13068
13102
|
if (standardsResult.status === "fulfilled") {
|
|
13069
13103
|
const standards = standardsResult.value ?? [];
|
|
@@ -13709,4 +13743,4 @@ export {
|
|
|
13709
13743
|
createProductBrainServer,
|
|
13710
13744
|
initFeatureFlags
|
|
13711
13745
|
};
|
|
13712
|
-
//# sourceMappingURL=chunk-
|
|
13746
|
+
//# sourceMappingURL=chunk-GYOYJTDC.js.map
|