feat: improved prompt efficiency for generic resources

This commit is contained in:
Marc Nuri
2025-03-01 08:43:47 +01:00
parent 900e1c7ca7
commit fa4c4728f4

View File

@@ -12,7 +12,8 @@ import (
func (s *Server) initResources() []server.ServerTool {
return []server.ServerTool{
{mcp.NewTool("resources_list",
mcp.WithDescription("List Kubernetes resources in the current cluster by providing their apiVersion and kind and optionally the namespace"),
mcp.WithDescription("List Kubernetes resources and objects in the current cluster by providing their apiVersion and kind and optionally the namespace\n"+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
mcp.WithString("apiVersion",
mcp.Description("apiVersion of the resources (examples of valid apiVersion are: v1, apps/v1, networking.k8s.io/v1)"),
mcp.Required(),
@@ -24,7 +25,8 @@ func (s *Server) initResources() []server.ServerTool {
mcp.WithString("namespace",
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},
{mcp.NewTool("resources_get",
mcp.WithDescription("Get a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name"),
mcp.WithDescription("Get a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name\n"+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
mcp.WithString("apiVersion",
mcp.Description("apiVersion of the resource (examples of valid apiVersion are: v1, apps/v1, networking.k8s.io/v1)"),
mcp.Required(),
@@ -39,14 +41,16 @@ func (s *Server) initResources() []server.ServerTool {
mcp.WithString("name", mcp.Description("Name of the resource"), mcp.Required()),
), s.resourcesGet},
{mcp.NewTool("resources_create_or_update",
mcp.WithDescription("Create or update a Kubernetes resource in the current cluster by providing a YAML or JSON representation of the resource"),
mcp.WithDescription("Create or update a Kubernetes resource in the current cluster by providing a YAML or JSON representation of the resource\n"+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
mcp.WithString("resource",
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"),
mcp.Required(),
),
), s.resourcesCreateOrUpdate},
{mcp.NewTool("resources_delete",
mcp.WithDescription("Delete a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name"),
mcp.WithDescription("Delete a Kubernetes resource in the current cluster by providing its apiVersion, kind, optionally the namespace, and its name\n"+
"(typical apiVersion and kind include: v1 Pod, v1 Service, apps/v1 Deployment, networking.k8s.io/v1 Ingress)"),
mcp.WithString("apiVersion",
mcp.Description("apiVersion of the resource (examples of valid apiVersion are: v1, apps/v1, networking.k8s.io/v1)"),
mcp.Required(),