diff --git a/pkg/tools/filesystem.go b/pkg/tools/filesystem.go index dbd9261a5..17f67e3b0 100644 --- a/pkg/tools/filesystem.go +++ b/pkg/tools/filesystem.go @@ -159,7 +159,9 @@ func (t *ReadFileTool) Execute(ctx context.Context, args map[string]any) *ToolRe } // Recompose the complete content by merging the header and the rest - fullContent := append(header, rest...) + fullContent := make([]byte, 0, len(header)+len(rest)) + fullContent = append(fullContent, header...) + fullContent = append(fullContent, rest...) return NewToolResult(string(fullContent)) }