diff --git a/server/mcp/mcp.go b/server/mcp/mcp.go index 648fbb440..40260060a 100644 --- a/server/mcp/mcp.go +++ b/server/mcp/mcp.go @@ -54,8 +54,8 @@ func NewHandler(host http.Handler, baseUrl, basePath string) (http.Handler, erro RequestHandler: requestHandler(host), }) - srv.AddTool(mcp.NewTool("evcc-docs", - mcp.WithDescription("evcc documentation"), + srv.AddTool(mcp.NewTool("docs", + mcp.WithDescription("Documentation"), ), docsTool) srv.AddPrompt(mcp.NewPrompt("create-charge-plan", @@ -77,19 +77,20 @@ func NewHandler(host http.Handler, baseUrl, basePath string) (http.Handler, erro func nameFormat(log *util.Logger) func(name string) string { return func(name string) string { - res := name - res = strings.ReplaceAll(res, "_/", "/") + // move method to the end + parts := strings.Split(name, "_") + res := strings.Join(parts[:len(parts)-1], "-") + "-" + parts[len(parts)-1] + + res = strings.TrimPrefix(res, "/") res = strings.ReplaceAll(res, "/", "-") - res = strings.ReplaceAll(res, "{", "with_") + res = strings.ReplaceAll(res, "{", "_") res = strings.ReplaceAll(res, "}", "") + 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] - } + res = res[:64] } log.TRACE.Println("adding tool:", res)