-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathdefinitions.go
More file actions
181 lines (179 loc) · 5.92 KB
/
definitions.go
File metadata and controls
181 lines (179 loc) · 5.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
package tools
import "github.com/mark3labs/mcp-go/mcp"
func GetToolDefinitions() []mcp.Tool {
return []mcp.Tool{
{
Name: "k8s_scale_deployment",
Description: "Scale a Kubernetes deployment to the specified number of replicas",
InputSchema: mcp.ToolInputSchema{
Type: "object",
Properties: map[string]interface{}{
"namespace": map[string]interface{}{
"type": "string",
"description": "Kubernetes namespace containing the deployment",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"name": map[string]interface{}{
"type": "string",
"description": "Name of the deployment to scale",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"replicas": map[string]interface{}{
"type": "integer",
"description": "Target number of replicas (0-100)",
"minimum": 0,
"maximum": 100,
},
"confirm": map[string]interface{}{
"type": "boolean",
"description": "Confirmation that you want to perform this scaling operation",
"const": true,
},
},
Required: []string{"namespace", "name", "replicas", "confirm"},
},
},
{
Name: "k8s_restart_deployment",
Description: "Restart a Kubernetes deployment by updating its restart annotation",
InputSchema: mcp.ToolInputSchema{
Type: "object",
Properties: map[string]interface{}{
"namespace": map[string]interface{}{
"type": "string",
"description": "Kubernetes namespace containing the deployment",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"name": map[string]interface{}{
"type": "string",
"description": "Name of the deployment to restart",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"confirm": map[string]interface{}{
"type": "boolean",
"description": "Confirmation that you want to restart this deployment",
"const": true,
},
},
Required: []string{"namespace", "name", "confirm"},
},
},
{
Name: "k8s_get_pod_logs",
Description: "Retrieve logs from a Kubernetes pod with filtering options",
InputSchema: mcp.ToolInputSchema{
Type: "object",
Properties: map[string]interface{}{
"namespace": map[string]interface{}{
"type": "string",
"description": "Kubernetes namespace containing the pod",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"name": map[string]interface{}{
"type": "string",
"description": "Name of the pod to get logs from",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"container": map[string]interface{}{
"type": "string",
"description": "Container name (optional, defaults to first container)",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"tailLines": map[string]interface{}{
"type": "integer",
"description": "Number of lines to tail (optional, defaults to 100)",
"minimum": 1,
"maximum": 10000,
"default": 100,
},
"sinceSeconds": map[string]interface{}{
"type": "integer",
"description": "Show logs from this many seconds ago (optional)",
"minimum": 1,
"maximum": 86400, // 24 hours max
},
},
Required: []string{"namespace", "name"},
},
},
{
Name: "k8s_create_configmap",
Description: "Create or update a Kubernetes ConfigMap with the specified data",
InputSchema: mcp.ToolInputSchema{
Type: "object",
Properties: map[string]interface{}{
"namespace": map[string]interface{}{
"type": "string",
"description": "Kubernetes namespace for the ConfigMap",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"name": map[string]interface{}{
"type": "string",
"description": "Name of the ConfigMap",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"data": map[string]interface{}{
"type": "object",
"description": "Key-value pairs for the ConfigMap data",
"additionalProperties": map[string]interface{}{
"type": "string",
},
},
"labels": map[string]interface{}{
"type": "object",
"description": "Labels to apply to the ConfigMap (optional)",
"additionalProperties": map[string]interface{}{
"type": "string",
},
},
},
Required: []string{"namespace", "name", "data"},
},
},
{
Name: "k8s_list_pods",
Description: "List all pods in a Kubernetes namespace with their status and details",
InputSchema: mcp.ToolInputSchema{
Type: "object",
Properties: map[string]interface{}{
"namespace": map[string]interface{}{
"type": "string",
"description": "Kubernetes namespace to list pods from",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
},
Required: []string{"namespace"},
},
},
{
Name: "k8s_delete_pod",
Description: "Delete a specific Kubernetes pod (use with caution)",
InputSchema: mcp.ToolInputSchema{
Type: "object",
Properties: map[string]interface{}{
"namespace": map[string]interface{}{
"type": "string",
"description": "Kubernetes namespace containing the pod",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"name": map[string]interface{}{
"type": "string",
"description": "Name of the pod to delete",
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
},
"force": map[string]interface{}{
"type": "boolean",
"description": "Force delete the pod immediately (optional)",
"default": false,
},
"confirm": map[string]interface{}{
"type": "boolean",
"description": "Confirmation that you want to delete this pod",
"const": true,
},
},
Required: []string{"namespace", "name", "confirm"},
},
},
}
}