test: always use short tool descriptions for tests

Andrey Nering created

Change summary

internal/agent/tools/tools.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Detailed changes

internal/agent/tools/tools.go 🔗

@@ -5,6 +5,7 @@ import (
 	"os"
 	"strconv"
 	"strings"
+	"testing"
 )
 
 type (
@@ -62,8 +63,10 @@ func GetModelNameFromContext(ctx context.Context) string {
 // markdown description when CRUSH_SHORT_TOOL_DESCRIPTIONS is set, significantly
 // reducing token usage. Otherwise returns the full description.
 func FirstLineDescription(content []byte) string {
-	if v, _ := strconv.ParseBool(os.Getenv("CRUSH_SHORT_TOOL_DESCRIPTIONS")); !v {
-		return strings.TrimSpace(string(content))
+	if !testing.Testing() {
+		if v, _ := strconv.ParseBool(os.Getenv("CRUSH_SHORT_TOOL_DESCRIPTIONS")); !v {
+			return strings.TrimSpace(string(content))
+		}
 	}
 	for line := range strings.SplitSeq(string(content), "\n") {
 		line = strings.TrimSpace(line)