Mcp: limit tool names to 64 characters for Claude Code

This commit is contained in:
andig 2025-07-08 21:57:23 +02:00
parent 20c56dd9ff
commit 04f48d7be4

View file

@ -83,6 +83,15 @@ func nameFormat(log *util.Logger) func(name string) string {
res = strings.ReplaceAll(res, "{", "with_")
res = strings.ReplaceAll(res, "}", "")
res = strings.ToLower(res)
// Claude Code has a 64 character limit for tool names
if len(res) > 64 {
res = strings.ReplaceAll(res, "with_", "w_")
if len(res) > 64 {
res = res[:64]
}
}
log.TRACE.Println("adding tool:", res)
return res
}