Skip to content

Commit 67f2d22

Browse files
authored
refactor(tools): rename and simplify Kubernetes tools (#54)
Renames all container orchestration-related MCP tools, changing their prefix from `kubernetes_` to `k8s_`. Tool names are sent to the LLM within its context (System Prompt) in every interaction. Changing `troubleshooting_kubernetes_` (27 characters) to `k8s_` (4 characters) across more than 15 tools represents a significant saving of repetitive text and reduction in input token consumption. Moreover, some LLM clients impose a limit of tool name length, this addresses that limitation as well.
1 parent 68b3f90 commit 67f2d22

35 files changed

+355
-355
lines changed

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,82 +108,82 @@ The server dynamically filters the available tools based on the permissions asso
108108
- **Required Permission**: `sage.exec`, `risks.read`
109109
- **Sample Prompt**: "Run this query: MATCH CloudResource WHERE type = 'aws_s3_bucket' LIMIT 10"
110110

111-
- **`kubernetes_list_clusters`**
111+
- **`k8s_list_clusters`**
112112
- **Description**: Lists the cluster information for all clusters or just the cluster specified.
113113
- **Required Permission**: `metrics-data.read`
114114
- **Sample Prompt**: "List all kubernetes clusters" or "Show me info for cluster 'production-gke'"
115115

116-
- **`kubernetes_list_nodes`**
116+
- **`k8s_list_nodes`**
117117
- **Description**: Lists the node information for all nodes, all nodes from a cluster or just the node specified.
118118
- **Required Permission**: `metrics-data.read`
119119
- **Sample Prompt**: "List all kubernetes nodes in the cluster 'production-gke'" or "Show me info for node 'node-123'"
120120

121-
- **`kubernetes_list_workloads`**
121+
- **`k8s_list_workloads`**
122122
- **Description**: Lists all the workloads that are in a particular state, desired, ready, running or unavailable. The LLM can filter by cluster, namespace, workload name or type.
123123
- **Required Permission**: `metrics-data.read`
124124
- **Sample Prompt**: "List all desired workloads in the cluster 'production-gke' and namespace 'default'"
125125

126-
- **`kubernetes_list_pod_containers`**
126+
- **`k8s_list_pod_containers`**
127127
- **Description**: Retrieves information from a particular pod and container.
128128
- **Required Permission**: `metrics-data.read`
129129
- **Sample Prompt**: "Show me info for pod 'my-pod' in cluster 'production-gke'"
130130

131-
- **`kubernetes_list_cronjobs`**
131+
- **`k8s_list_cronjobs`**
132132
- **Description**: Retrieves information from the cronjobs in the cluster.
133133
- **Required Permission**: `metrics-data.read`
134134
- **Sample Prompt**: "List all cronjobs in cluster 'prod' and namespace 'default'"
135135

136-
- **`troubleshoot_kubernetes_list_top_unavailable_pods`**
136+
- **`k8s_list_top_unavailable_pods`**
137137
- **Description**: Shows the top N pods with the highest number of unavailable or unready replicas in a Kubernetes cluster, ordered from highest to lowest.
138138
- **Required Permission**: `metrics-data.read`
139139
- **Sample Prompt**: "Show the top 20 unavailable pods in cluster 'production'"
140140

141-
- **`troubleshoot_kubernetes_list_top_restarted_pods`**
141+
- **`k8s_list_top_restarted_pods`**
142142
- **Description**: Lists the pods with the highest number of container restarts in the specified scope (cluster, namespace, workload, or individual pod). By default, it returns the top 10.
143143
- **Required Permission**: `metrics-data.read`
144144
- **Sample Prompt**: "Show the top 10 pods with the most container restarts in cluster 'production'"
145145

146-
- **`troubleshoot_kubernetes_list_top_400_500_http_errors_in_pods`**
146+
- **`k8s_list_top_http_errors_in_pods`**
147147
- **Description**: Lists the pods with the highest rate of HTTP 4xx and 5xx errors over a specified time interval, allowing filtering by cluster, namespace, workload type, and workload name.
148148
- **Required Permission**: `metrics-data.read`
149149
- **Sample Prompt**: "Show the top 20 pods with the most HTTP errors in cluster 'production'"
150150

151-
- **`troubleshoot_kubernetes_list_top_network_errors_in_pods`**
151+
- **`k8s_list_top_network_errors_in_pods`**
152152
- **Description**: Shows the top network errors by pod over a given interval, aggregated by cluster, namespace, workload type, and workload name. The result is an average rate of network errors per second.
153153
- **Required Permission**: `metrics-data.read`
154154
- **Sample Prompt**: "Show the top 10 pods with the most network errors in cluster 'production'"
155155

156-
- **`troubleshoot_kubernetes_list_count_pods_per_cluster`**
156+
- **`k8s_list_count_pods_per_cluster`**
157157
- **Description**: List the count of running Kubernetes Pods grouped by cluster and namespace.
158158
- **Required Permission**: `metrics-data.read`
159159
- **Sample Prompt**: "List the count of running Kubernetes Pods in cluster 'production'"
160160

161-
- **`troubleshoot_kubernetes_list_underutilized_pods_by_cpu_quota`**
161+
- **`k8s_list_underutilized_pods_cpu_quota`**
162162
- **Description**: List Kubernetes pods with CPU usage below 25% of the quota limit.
163163
- **Required Permission**: `metrics-data.read`
164164
- **Sample Prompt**: "Show the top 10 underutilized pods by CPU quota in cluster 'production'"
165165

166-
- **`troubleshoot_kubernetes_list_underutilized_pods_by_memory_quota`**
166+
- **`k8s_list_underutilized_pods_memory_quota`**
167167
- **Description**: List Kubernetes pods with memory usage below 25% of the limit.
168168
- **Required Permission**: `metrics-data.read`
169169
- **Sample Prompt**: "Show the top 10 underutilized pods by memory quota in cluster 'production'"
170170

171-
- **`troubleshoot_kubernetes_list_top_cpu_consumed_by_workload`**
171+
- **`k8s_list_top_cpu_consumed_workload`**
172172
- **Description**: Identifies the Kubernetes workloads (all containers) consuming the most CPU (in cores).
173173
- **Required Permission**: `metrics-data.read`
174174
- **Sample Prompt**: "Show the top 10 workloads consuming the most CPU in cluster 'production'"
175175

176-
- **`troubleshoot_kubernetes_list_top_cpu_consumed_by_container`**
176+
- **`k8s_list_top_cpu_consumed_container`**
177177
- **Description**: Identifies the Kubernetes containers consuming the most CPU (in cores).
178178
- **Required Permission**: `metrics-data.read`
179179
- **Sample Prompt**: "Show the top 10 containers consuming the most CPU in cluster 'production'"
180180

181-
- **`troubleshoot_kubernetes_list_top_memory_consumed_by_workload`**
181+
- **`k8s_list_top_memory_consumed_workload`**
182182
- **Description**: Lists memory-intensive workloads (all containers).
183183
- **Required Permission**: `metrics-data.read`
184184
- **Sample Prompt**: "Show the top 10 workloads consuming the most memory in cluster 'production'"
185185

186-
- **`troubleshoot_kubernetes_list_top_memory_consumed_by_container`**
186+
- **`k8s_list_top_memory_consumed_container`**
187187
- **Description**: Lists memory-intensive containers.
188188
- **Required Permission**: `metrics-data.read`
189189
- **Sample Prompt**: "Show the top 10 containers consuming the most memory in cluster 'production'"

cmd/server/main.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,22 @@ func setupHandler(sysdigClient sysdig.ExtendedClientWithResponsesInterface) *mcp
9595
tools.NewToolRunSysql(sysdigClient),
9696
tools.NewToolGenerateSysql(sysdigClient),
9797

98-
tools.NewKubernetesListClusters(sysdigClient),
99-
tools.NewKubernetesListNodes(sysdigClient),
100-
tools.NewKubernetesListCronjobs(sysdigClient),
101-
tools.NewKubernetesListWorkloads(sysdigClient),
102-
tools.NewKubernetesListPodContainers(sysdigClient),
103-
tools.NewTroubleshootKubernetesListTopUnavailablePods(sysdigClient),
104-
tools.NewTroubleshootKubernetesListTopRestartedPods(sysdigClient),
105-
tools.NewTroubleshootKubernetesListTop400500HttpErrorsInPods(sysdigClient),
106-
tools.NewTroubleshootKubernetesListTopNetworkErrorsInPods(sysdigClient),
107-
tools.NewTroubleshootKubernetesListCountPodsPerCluster(sysdigClient),
108-
tools.NewTroubleshootKubernetesListUnderutilizedPodsByCPUQuota(sysdigClient),
109-
tools.NewTroubleshootKubernetesListTopCPUConsumedByWorkload(sysdigClient),
110-
tools.NewTroubleshootKubernetesListTopCPUConsumedByContainer(sysdigClient),
111-
tools.NewTroubleshootKubernetesListUnderutilizedPodsByMemoryQuota(sysdigClient),
112-
tools.NewTroubleshootKubernetesListTopMemoryConsumedByWorkload(sysdigClient),
113-
tools.NewTroubleshootKubernetesListTopMemoryConsumedByContainer(sysdigClient),
98+
tools.NewK8sListClusters(sysdigClient),
99+
tools.NewK8sListNodes(sysdigClient),
100+
tools.NewK8sListCronjobs(sysdigClient),
101+
tools.NewK8sListWorkloads(sysdigClient),
102+
tools.NewK8sListPodContainers(sysdigClient),
103+
tools.NewK8sListTopUnavailablePods(sysdigClient),
104+
tools.NewK8sListTopRestartedPods(sysdigClient),
105+
tools.NewK8sListTopHttpErrorsInPods(sysdigClient),
106+
tools.NewK8sListTopNetworkErrorsInPods(sysdigClient),
107+
tools.NewK8sListCountPodsPerCluster(sysdigClient),
108+
tools.NewK8sListUnderutilizedPodsCPUQuota(sysdigClient),
109+
tools.NewK8sListTopCPUConsumedWorkload(sysdigClient),
110+
tools.NewK8sListTopCPUConsumedContainer(sysdigClient),
111+
tools.NewK8sListUnderutilizedPodsMemoryQuota(sysdigClient),
112+
tools.NewK8sListTopMemoryConsumedWorkload(sysdigClient),
113+
tools.NewK8sListTopMemoryConsumedContainer(sysdigClient),
114114
)
115115
return handler
116116
}

0 commit comments

Comments
 (0)