You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
s.Require().Greater(len(s.pathHeaders), 0, "No requests were made to Kube API")
112
+
s.Run("DiscoveryClient propagates "+header+" header to Kube API", func() {
113
+
s.Require().NotNil(s.pathHeaders["/api"], "No requests were made to /api")
114
+
s.Equal("Bearer a-token-from-mcp-client", s.pathHeaders["/api"].Get("Authorization"), "Overridden header Authorization not found in request to /api")
115
+
s.Require().NotNil(s.pathHeaders["/apis"], "No requests were made to /apis")
116
+
s.Equal("Bearer a-token-from-mcp-client", s.pathHeaders["/apis"].Get("Authorization"), "Overridden header Authorization not found in request to /apis")
117
+
s.Require().NotNil(s.pathHeaders["/api/v1"], "No requests were made to /api/v1")
118
+
s.Equal("Bearer a-token-from-mcp-client", s.pathHeaders["/api/v1"].Get("Authorization"), "Overridden header Authorization not found in request to /api/v1")
108
119
})
109
-
t.Run("DynamicClient propagates headers to Kube API", func(t*testing.T) {
t.Fatalf("Overridden header Authorization not found in request to /api/v1/namespaces/default/pods")
115
-
}
120
+
s.Run("DynamicClient propagates "+header+" header to Kube API", func() {
121
+
s.Require().NotNil(s.pathHeaders["/api/v1/namespaces/default/pods"], "No requests were made to /api/v1/namespaces/default/pods")
122
+
s.Equal("Bearer a-token-from-mcp-client", s.pathHeaders["/api/v1/namespaces/default/pods"].Get("Authorization"), "Overridden header Authorization not found in request to /api/v1/namespaces/default/pods")
s.Run("kubernetes.Interface propagates "+header+" header to Kube API", func() {
126
+
s.Require().NotNil(s.pathHeaders["/api/v1/namespaces/default/pods/a-pod-to-delete"], "No requests were made to /api/v1/namespaces/default/pods/a-pod-to-delete")
127
+
s.Equal("Bearer a-token-from-mcp-client", s.pathHeaders["/api/v1/namespaces/default/pods/a-pod-to-delete"].Get("Authorization"), "Overridden header Authorization not found in request to /api/v1/namespaces/default/pods/a-pod-to-delete")
s.Require().NotNil(toolResult, "toolResult should not be nil")
284
+
s.Run("has error", func() {
285
+
s.Truef(toolResult.IsError, "call tool should fail")
286
+
s.Nilf(err, "call tool should not return error object")
287
+
})
288
+
s.Run("describes missing node", func() {
289
+
expectedMessage:="failed to get node stats summary for inexistent-node: failed to get node inexistent-node: the server could not find the requested resource (get nodes inexistent-node)"
Copy file name to clipboardExpand all lines: pkg/mcp/testdata/toolsets-core-tools.json
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,29 @@
67
67
},
68
68
"name": "nodes_log"
69
69
},
70
+
{
71
+
"annotations": {
72
+
"title": "Node: Stats Summary",
73
+
"readOnlyHint": true,
74
+
"destructiveHint": false,
75
+
"idempotentHint": false,
76
+
"openWorldHint": true
77
+
},
78
+
"description": "Get detailed resource usage statistics from a Kubernetes node via the kubelet's Summary API. Provides comprehensive metrics including CPU, memory, filesystem, and network usage at the node, pod, and container levels. On systems with cgroup v2 and kernel 4.20+, also includes PSI (Pressure Stall Information) metrics that show resource pressure for CPU, memory, and I/O. See https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/ for details on PSI metrics",
79
+
"inputSchema": {
80
+
"type": "object",
81
+
"properties": {
82
+
"name": {
83
+
"description": "Name of the node to get stats from",
Copy file name to clipboardExpand all lines: pkg/mcp/testdata/toolsets-full-tools-multicluster-enum.json
+31Lines changed: 31 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -237,6 +237,37 @@
237
237
},
238
238
"name": "nodes_log"
239
239
},
240
+
{
241
+
"annotations": {
242
+
"title": "Node: Stats Summary",
243
+
"readOnlyHint": true,
244
+
"destructiveHint": false,
245
+
"idempotentHint": false,
246
+
"openWorldHint": true
247
+
},
248
+
"description": "Get detailed resource usage statistics from a Kubernetes node via the kubelet's Summary API. Provides comprehensive metrics including CPU, memory, filesystem, and network usage at the node, pod, and container levels. On systems with cgroup v2 and kernel 4.20+, also includes PSI (Pressure Stall Information) metrics that show resource pressure for CPU, memory, and I/O. See https://kubernetes.io/docs/reference/instrumentation/understand-psi-metrics/ for details on PSI metrics",
249
+
"inputSchema": {
250
+
"type": "object",
251
+
"properties": {
252
+
"context": {
253
+
"description": "Optional parameter selecting which context to run the tool in. Defaults to fake-context if not set",
254
+
"enum": [
255
+
"extra-cluster",
256
+
"fake-context"
257
+
],
258
+
"type": "string"
259
+
},
260
+
"name": {
261
+
"description": "Name of the node to get stats from",
0 commit comments