Skip to content

Commit bde1813

Browse files
committed
fix: add ^ and $ to patterns
1 parent d8fa986 commit bde1813

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/mcp/pods.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func (s *Server) initPods() []server.ServerTool {
1818
return []server.ServerTool{
1919
{Tool: mcp.NewTool("pods_list",
2020
mcp.WithDescription("List all the Kubernetes pods in the current cluster from all namespaces"),
21-
mcp.WithString("labelSelector", mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")),
21+
mcp.WithString("labelSelector", mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$")),
2222
// Tool annotations
2323
mcp.WithTitleAnnotation("Pods: List"),
2424
mcp.WithReadOnlyHintAnnotation(true),
@@ -28,7 +28,7 @@ func (s *Server) initPods() []server.ServerTool {
2828
{Tool: mcp.NewTool("pods_list_in_namespace",
2929
mcp.WithDescription("List all the Kubernetes pods in the specified namespace in the current cluster"),
3030
mcp.WithString("namespace", mcp.Description("Namespace to list pods from"), mcp.Required()),
31-
mcp.WithString("labelSelector", mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")),
31+
mcp.WithString("labelSelector", mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$")),
3232
// Tool annotations
3333
mcp.WithTitleAnnotation("Pods: List in Namespace"),
3434
mcp.WithReadOnlyHintAnnotation(true),
@@ -61,7 +61,7 @@ func (s *Server) initPods() []server.ServerTool {
6161
mcp.WithBoolean("all_namespaces", mcp.Description("If true, list the resource consumption for all Pods in all namespaces. If false, list the resource consumption for Pods in the provided namespace or the current namespace"), mcp.DefaultBool(true)),
6262
mcp.WithString("namespace", mcp.Description("Namespace to get the Pods resource consumption from (Optional, current namespace if not provided and all_namespaces is false)")),
6363
mcp.WithString("name", mcp.Description("Name of the Pod to get the resource consumption from (Optional, all Pods in the namespace if not provided)")),
64-
mcp.WithString("label_selector", mcp.Description("Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label (Optional, only applicable when name is not provided)"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")),
64+
mcp.WithString("label_selector", mcp.Description("Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label (Optional, only applicable when name is not provided)"), mcp.Pattern("^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$")),
6565
// Tool annotations
6666
mcp.WithTitleAnnotation("Pods: Top"),
6767
mcp.WithReadOnlyHintAnnotation(true),

pkg/mcp/resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (s *Server) initResources() []server.ServerTool {
3434
mcp.WithString("namespace",
3535
mcp.Description("Optional Namespace to retrieve the namespaced resources from (ignored in case of cluster scoped resources). If not provided, will list resources from all namespaces")),
3636
mcp.WithString("labelSelector",
37-
mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]")),
37+
mcp.Description("Optional Kubernetes label selector (e.g. 'app=myapp,env=prod' or 'app in (myapp,yourapp)'), use this option when you want to filter the pods by label"), mcp.Pattern("^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$")),
3838
// Tool annotations
3939
mcp.WithTitleAnnotation("Resources: List"),
4040
mcp.WithReadOnlyHintAnnotation(true),

0 commit comments

Comments
 (0)