@@ -17,7 +17,7 @@ import (
17
17
)
18
18
19
19
// Default tools to enable
20
- var DefaultTools = []string {"all" }
20
+ var DefaultTools = []string {}
21
21
22
22
// Service identity for JWT auth
23
23
const serviceIdentity = "genaiservice" // TODO: can change once we have our own service, not needed at the moment
@@ -29,11 +29,69 @@ var defaultJWTLifetime = 1 * time.Hour
29
29
// Default timeout for GenAI service
30
30
const defaultGenaiTimeout = 300 * time .Second
31
31
32
+ // createServiceClient is a helper function to create a service client with the given parameters
33
+ func createServiceClient (config * config.Config , serviceBaseURL , baseURL , path , secret string , timeouts ... time.Duration ) (* client.Client , error ) {
34
+ url := buildServiceURL (config , serviceBaseURL , baseURL , path )
35
+ return createClient (url , config , secret , timeouts ... )
36
+ }
37
+
38
+ // registerDefault registers the default toolset with essential tools from various services
39
+ func registerDefault (config * config.Config , tsg * toolsets.ToolsetGroup ) error {
40
+ // Create pipeline service client
41
+ pipelineClient , err := createServiceClient (config , config .PipelineSvcBaseURL , config .BaseURL , "pipeline" , config .PipelineSvcSecret )
42
+ if err != nil {
43
+ return fmt .Errorf ("failed to create client for pipeline service: %w" , err )
44
+ }
45
+ pipelineServiceClient := & client.PipelineService {Client : pipelineClient }
46
+
47
+ // Create connector service client
48
+ connectorClient , err := createServiceClient (config , config .NgManagerBaseURL , config .BaseURL , "ng/api" , config .NgManagerSecret )
49
+ if err != nil {
50
+ return fmt .Errorf ("failed to create client for connectors: %w" , err )
51
+ }
52
+ connectorServiceClient := & client.ConnectorService {Client : connectorClient }
53
+
54
+ // Create dashboard service client
55
+ customTimeout := 30 * time .Second
56
+ dashboardClient , err := createServiceClient (config , config .DashboardSvcBaseURL , config .BaseURL , "dashboard" , config .DashboardSvcSecret , customTimeout )
57
+ if err != nil {
58
+ return fmt .Errorf ("failed to create client for dashboard service: %w" , err )
59
+ }
60
+ dashboardServiceClient := & client.DashboardService {Client : dashboardClient }
61
+
62
+ // Create the default toolset with essential tools
63
+ defaultToolset := toolsets .NewToolset ("default" , "Default essential Harness tools" ).AddReadTools (
64
+ // Connector Management tools
65
+ toolsets .NewServerTool (GetConnectorDetailsTool (config , connectorServiceClient )),
66
+ toolsets .NewServerTool (ListConnectorCatalogueTool (config , connectorServiceClient )),
67
+
68
+ // Pipeline Management tools
69
+ toolsets .NewServerTool (ListPipelinesTool (config , pipelineServiceClient )),
70
+ toolsets .NewServerTool (GetPipelineTool (config , pipelineServiceClient )),
71
+ toolsets .NewServerTool (FetchExecutionURLTool (config , pipelineServiceClient )),
72
+ toolsets .NewServerTool (GetExecutionTool (config , pipelineServiceClient )),
73
+ toolsets .NewServerTool (ListExecutionsTool (config , pipelineServiceClient )),
74
+
75
+ // Dashboard tools
76
+ toolsets .NewServerTool (ListDashboardsTool (config , dashboardServiceClient )),
77
+ toolsets .NewServerTool (GetDashboardDataTool (config , dashboardServiceClient )),
78
+ )
79
+
80
+ // Add the default toolset to the group
81
+ tsg .AddToolset (defaultToolset )
82
+ return nil
83
+ }
84
+
32
85
// InitToolsets initializes and returns the toolset groups
33
86
func InitToolsets (config * config.Config ) (* toolsets.ToolsetGroup , error ) {
34
87
// Create a toolset group
35
88
tsg := toolsets .NewToolsetGroup (config .ReadOnly )
36
89
90
+ // Register default toolset with essential tools
91
+ if err := registerDefault (config , tsg ); err != nil {
92
+ return nil , err
93
+ }
94
+
37
95
// Register pipelines
38
96
if err := registerPipelines (config , tsg ); err != nil {
39
97
return nil , err
@@ -594,6 +652,7 @@ func registerCloudCostManagement(config *config.Config, tsg *toolsets.ToolsetGro
594
652
595
653
// registerGenai registers the genai toolset
596
654
func registerGenai (config * config.Config , tsg * toolsets.ToolsetGroup ) error {
655
+
597
656
// Skip registration for external mode for now
598
657
if ! config .Internal {
599
658
return nil
0 commit comments