fix(kiro): preserve underscores in tool names and restore sanitized names in responses

Do not collapse consecutive underscores in uniqueName so mcp__server__tool is sent intact to Kiro, attach reverse map on request translation, and restore client tool names in responses.
This commit is contained in:
Qisthi Ramadhani
2026-09-17 18:13:14 +07:00
parent 82b1bca42a
commit c49efdf528
4 changed files with 118 additions and 7 deletions

View File

@@ -48,7 +48,6 @@ function uniqueName(rawName, index, usedNames) {
const cleaned = String(rawName || "")
.trim()
.replace(TOOL_NAME_PATTERN, "_")
.replace(/_+/g, "_")
.replace(/^_+|_+$/g, "");
const base = trimCodePoints(cleaned || `tool_${index + 1}`, KIRO_TOOL_NAME_MAX_LENGTH);
let candidate = base;