on main help sign in
test: always use short tool descriptions for tests
23073a3Andrey Nering
internal/agent/tools/tools.go+5−2
@@ -5,6 +5,7 @@ import (
5 "os"
5 "os"
6 "strconv"
6 "strconv"
7 "strings"
7 "strings"
8+ "testing"
8)
9)
9
10
10type (
11type (
@@ -62,8 +63,10 @@ func GetModelNameFromContext(ctx context.Context) string {
62// markdown description when CRUSH_SHORT_TOOL_DESCRIPTIONS is set, significantly
63// markdown description when CRUSH_SHORT_TOOL_DESCRIPTIONS is set, significantly
63// reducing token usage. Otherwise returns the full description.
64// reducing token usage. Otherwise returns the full description.
64func FirstLineDescription(content []byte) string {
65func FirstLineDescription(content []byte) string {
66+ if !testing.Testing() {
65− if v, _ := strconv.ParseBool(os.Getenv("CRUSH_SHORT_TOOL_DESCRIPTIONS")); !v {
67+ if v, _ := strconv.ParseBool(os.Getenv("CRUSH_SHORT_TOOL_DESCRIPTIONS")); !v {
66− return strings.TrimSpace(string(content))
68+ return strings.TrimSpace(string(content))
69+ }
67 }
70 }
68 for line := range strings.SplitSeq(string(content), "\n") {
71 for line := range strings.SplitSeq(string(content), "\n") {
69 line = strings.TrimSpace(line)
72 line = strings.TrimSpace(line)