Skip to content

Commit fa4c472

Browse files
committed
feat: improved prompt efficiency for generic resources
1 parent 900e1c7 commit fa4c472

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/mcp/resources.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
func (s *Server) initResources() []server.ServerTool {
1313
return []server.ServerTool{
1414
{mcp.NewTool("resources_list",
15-
mcp.WithDescription("List Kubernetes resources in the current cluster by providing their apiVersion and kind and optionally the namespace"),
15+
mcp.WithDescription("List Kubernetes resources and objects in the current cluster by providing their apiVersion and kind and optionally the namespace\n"+
16+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
1617
mcp.WithString("apiVersion",
1718
mcp.Description("apiVersion of the resources (examples of valid apiVersion are: v1, apps/v1, networking.k8s.io/v1)"),
1819
mcp.Required(),
@@ -24,7 +25,8 @@ func (s *Server) initResources() []server.ServerTool {
2425
mcp.WithString("namespace",
2526
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"))), s.resourcesList},
2627
{mcp.NewTool("resources_get",
27-
mcp.WithDescription("Get a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name"),
28+
mcp.WithDescription("Get a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name\n"+
29+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
2830
mcp.WithString("apiVersion",
2931
mcp.Description("apiVersion of the resource (examples of valid apiVersion are: v1, apps/v1, networking.k8s.io/v1)"),
3032
mcp.Required(),
@@ -39,14 +41,16 @@ func (s *Server) initResources() []server.ServerTool {
3941
mcp.WithString("name", mcp.Description("Name of the resource"), mcp.Required()),
4042
), s.resourcesGet},
4143
{mcp.NewTool("resources_create_or_update",
42-
mcp.WithDescription("Create or update a Kubernetes resource in the current cluster by providing a YAML or JSON representation of the resource"),
44+
mcp.WithDescription("Create or update a Kubernetes resource in the current cluster by providing a YAML or JSON representation of the resource\n"+
45+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
4346
mcp.WithString("resource",
4447
mcp.Description("A JSON or YAML containing a representation of the Kubernetes resource. Should include top-level fields such as apiVersion,kind,metadata, and spec"),
4548
mcp.Required(),
4649
),
4750
), s.resourcesCreateOrUpdate},
4851
{mcp.NewTool("resources_delete",
49-
mcp.WithDescription("Delete a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name"),
52+
mcp.WithDescription("Delete a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name\n"+
53+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
5054
mcp.WithString("apiVersion",
5155
mcp.Description("apiVersion of the resource (examples of valid apiVersion are: v1, apps/v1, networking.k8s.io/v1)"),
5256
mcp.Required(),

0 commit comments

Comments
 (0)