metheus-governance-mcp-cli 0.2.39 → 0.2.41

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.
Files changed (2) hide show
  1. package/cli.mjs +25 -8
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -3563,16 +3563,33 @@ function buildToolAliasMaps(tools) {
3563
3563
  return { aliasToCanonical, canonicalToAlias };
3564
3564
  }
3565
3565
 
3566
- function applyToolAliasesToToolsListResponse(responseObj, canonicalToAlias) {
3566
+ function appendToolAliasesToToolsListResponse(responseObj, canonicalToAlias) {
3567
3567
  const result = safeObject(responseObj.result);
3568
3568
  const tools = ensureArray(result.tools);
3569
- result.tools = tools.map((tool) => {
3569
+ const outputTools = [];
3570
+ const reservedNames = new Set();
3571
+
3572
+ for (const tool of tools) {
3570
3573
  const safeTool = safeObject(tool);
3571
3574
  const currentName = String(safeTool.name || "").trim();
3572
- const aliasName = canonicalToAlias.get(currentName);
3573
- if (!aliasName) return safeTool;
3574
- return { ...safeTool, name: aliasName };
3575
- });
3575
+ if (currentName) {
3576
+ reservedNames.add(currentName);
3577
+ }
3578
+ outputTools.push(safeTool);
3579
+ }
3580
+
3581
+ for (const tool of tools) {
3582
+ const safeTool = safeObject(tool);
3583
+ const canonicalName = String(safeTool.name || "").trim();
3584
+ if (!canonicalName) continue;
3585
+ const aliasName = String(canonicalToAlias.get(canonicalName) || "").trim();
3586
+ if (!aliasName || reservedNames.has(aliasName)) continue;
3587
+ const aliasTool = { ...safeTool, name: aliasName };
3588
+ outputTools.push(aliasTool);
3589
+ reservedNames.add(aliasName);
3590
+ }
3591
+
3592
+ result.tools = outputTools;
3576
3593
  responseObj.result = result;
3577
3594
  return responseObj;
3578
3595
  }
@@ -3653,7 +3670,7 @@ function appendProjectHintToInitialize(responseObj, args, options = {}) {
3653
3670
  "High-priority project bootstrap rule:",
3654
3671
  ...(useSafeToolAliases
3655
3672
  ? [
3656
- "- This session uses safe MCP tool aliases (underscore format). Use `project_summary` / `ctxpack_ensure` / `workitem_list` style names, not dotted names.",
3673
+ "- This session supports safe MCP tool aliases (underscore format). Prefer `project_summary` / `ctxpack_ensure` / `workitem_list`; dotted names are also accepted.",
3657
3674
  ]
3658
3675
  : []),
3659
3676
  `- MUST call \`${projectSummaryTool}\` first when the user provides only a Project ID or asks project overview/agenda.`,
@@ -4585,7 +4602,7 @@ async function runProxy(flags) {
4585
4602
  const aliasMaps = buildToolAliasMaps(tools);
4586
4603
  sessionToolAliasToCanonical = aliasMaps.aliasToCanonical;
4587
4604
  sessionToolCanonicalToAlias = aliasMaps.canonicalToAlias;
4588
- patched = applyToolAliasesToToolsListResponse(patched, sessionToolCanonicalToAlias);
4605
+ patched = appendToolAliasesToToolsListResponse(patched, sessionToolCanonicalToAlias);
4589
4606
  }
4590
4607
  } else if (isJsonRpcMethod(requestObj, "initialize")) {
4591
4608
  patched = appendProjectHintToInitialize(patched, args, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metheus-governance-mcp-cli",
3
- "version": "0.2.39",
3
+ "version": "0.2.41",
4
4
  "description": "Metheus Governance MCP CLI (setup + stdio proxy)",
5
5
  "type": "module",
6
6
  "files": [