diff --git a/htools/Ganeti/HTools/QC.hs b/htools/Ganeti/HTools/QC.hs
index 8705ad1640984fcc129c869be7d7347bad2571be..2410bdbbe6494141b2b1c99c5de68982502b4438 100644
--- a/htools/Ganeti/HTools/QC.hs
+++ b/htools/Ganeti/HTools/QC.hs
@@ -1847,6 +1847,9 @@ testSuite "JSON"
 
 -- * Luxi tests
 
+instance Arbitrary Luxi.TagObject where
+  arbitrary = elements [minBound..maxBound]
+
 instance Arbitrary Luxi.LuxiReq where
   arbitrary = elements [minBound..maxBound]
 
@@ -1866,7 +1869,7 @@ instance Arbitrary Luxi.LuxiOp where
                               (listOf getFQDN) <*> arbitrary
       Luxi.ReqQueryConfigValues -> Luxi.QueryConfigValues <$> getFields
       Luxi.ReqQueryClusterInfo -> pure Luxi.QueryClusterInfo
-      Luxi.ReqQueryTags -> Luxi.QueryTags <$> getName <*> getFQDN
+      Luxi.ReqQueryTags -> Luxi.QueryTags <$> arbitrary <*> getFQDN
       Luxi.ReqSubmitJob -> Luxi.SubmitJob <$> (resize maxOpCodes arbitrary)
       Luxi.ReqSubmitManyJobs -> Luxi.SubmitManyJobs <$>
                                 (resize maxOpCodes arbitrary)
diff --git a/htools/Ganeti/Luxi.hs b/htools/Ganeti/Luxi.hs
index 939302c235e99eb95cd593637a7779d8a96959f9..0ac40e792c2cace9e832080d2f68de286b261230 100644
--- a/htools/Ganeti/Luxi.hs
+++ b/htools/Ganeti/Luxi.hs
@@ -32,6 +32,7 @@ module Ganeti.Luxi
   , Client
   , JobId
   , RecvResult(..)
+  , TagObject(..)
   , strOfOp
   , checkRS
   , getClient
@@ -99,6 +100,15 @@ data RecvResult = RecvConnClosed    -- ^ Connection closed
 -- | The Ganeti job type.
 type JobId = Int
 
+-- | Data type representing what items do the tag operations apply to.
+$(declareSADT "TagObject"
+  [ ("TagInstance", 'tagInstance)
+  , ("TagNode",     'tagNode)
+  , ("TagGroup",    'tagNodegroup)
+  , ("TagCluster",  'tagCluster)
+  ])
+$(makeJSONInstance ''TagObject)
+
 -- | Currently supported Luxi operations and JSON serialization.
 $(genLuxiOp "LuxiOp"
   [(luxiReqQuery,
@@ -134,7 +144,7 @@ $(genLuxiOp "LuxiOp"
     )
   , (luxiReqQueryClusterInfo, [])
   , (luxiReqQueryTags,
-     [ ("kind", [t| String |])
+     [ ("kind", [t| TagObject |])
      , ("name", [t| String |])
      ])
   , (luxiReqSubmitJob,