metheus-governance-mcp-cli 0.2.45 → 0.2.46
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/cli.mjs +24 -2
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -3616,6 +3616,28 @@ function appendToolAliasesToToolsListResponse(responseObj, canonicalToAlias) {
|
|
|
3616
3616
|
return responseObj;
|
|
3617
3617
|
}
|
|
3618
3618
|
|
|
3619
|
+
function rewriteToolsListToSafeAliasesOnly(responseObj, canonicalToAlias) {
|
|
3620
|
+
const result = safeObject(responseObj.result);
|
|
3621
|
+
const tools = ensureArray(result.tools);
|
|
3622
|
+
const out = [];
|
|
3623
|
+
const used = new Set();
|
|
3624
|
+
|
|
3625
|
+
for (const tool of tools) {
|
|
3626
|
+
const safeTool = safeObject(tool);
|
|
3627
|
+
const canonicalName = String(safeTool.name || "").trim();
|
|
3628
|
+
if (!canonicalName) continue;
|
|
3629
|
+
const aliasName = String(canonicalToAlias.get(canonicalName) || "").trim();
|
|
3630
|
+
const finalName = aliasName || canonicalName;
|
|
3631
|
+
if (used.has(finalName)) continue;
|
|
3632
|
+
used.add(finalName);
|
|
3633
|
+
out.push({ ...safeTool, name: finalName });
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
result.tools = out;
|
|
3637
|
+
responseObj.result = result;
|
|
3638
|
+
return responseObj;
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3619
3641
|
function rewriteAliasedToolCallToCanonical(requestObj, aliasToCanonical) {
|
|
3620
3642
|
if (!isJsonRpcMethod(requestObj, "tools/call")) return requestObj;
|
|
3621
3643
|
const params = safeObject(requestObj.params);
|
|
@@ -3703,7 +3725,7 @@ function appendProjectHintToInitialize(responseObj, args, options = {}) {
|
|
|
3703
3725
|
"High-priority project bootstrap rule:",
|
|
3704
3726
|
...(useSafeToolAliases
|
|
3705
3727
|
? [
|
|
3706
|
-
"- This session
|
|
3728
|
+
"- This session uses safe MCP tool aliases (underscore format). Use `project_summary` / `ctxpack_ensure` / `workitem_list` style names, not dotted names.",
|
|
3707
3729
|
]
|
|
3708
3730
|
: []),
|
|
3709
3731
|
`- MUST call \`${projectSummaryTool}\` first when the user provides only a Project ID or asks project overview/agenda.`,
|
|
@@ -4650,7 +4672,7 @@ async function runProxy(flags) {
|
|
|
4650
4672
|
const aliasMaps = buildToolAliasMaps(tools);
|
|
4651
4673
|
sessionToolAliasToCanonical = aliasMaps.aliasToCanonical;
|
|
4652
4674
|
sessionToolCanonicalToAlias = aliasMaps.canonicalToAlias;
|
|
4653
|
-
patched =
|
|
4675
|
+
patched = rewriteToolsListToSafeAliasesOnly(patched, sessionToolCanonicalToAlias);
|
|
4654
4676
|
}
|
|
4655
4677
|
} else if (isJsonRpcMethod(requestObj, "initialize")) {
|
|
4656
4678
|
patched = appendProjectHintToInitialize(patched, args, {
|