Skip to main content
Glama

apply

Apply Kubernetes manifests from files or URLs to deploy and manage resources in your cluster. Specify a namespace or use the current context.

Instructions

Apply a Kubernetes manifest from a file or URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYesPath to the manifest file or URL
namespaceNoThe namespace to apply to (optional, defaults to current context namespace)

Implementation Reference

  • Handler function for the 'apply' tool. It destructures 'file' and optional 'namespace' from arguments, constructs the kubectl apply command, executes it using execAsync, and returns the stdout or a success message.
    case "apply": {
      const { file, namespace } = args;
      const nsArg = namespace ? `-n ${namespace}` : "";
      const cmd = `kubectl apply -f ${file} ${nsArg}`;
      const { stdout } = await execAsync(cmd);
      return {
        content: [{ 
          type: "text", 
          text: stdout || `Applied manifest from ${file}` 
        }]
      };
    }
  • Schema definition for the 'apply' tool in the tools array, used for list tools response. Specifies input parameters: required 'file' string and optional 'namespace' string.
    name: "apply",
    description: "Apply a Kubernetes manifest from a file or URL",
    inputSchema: {
      type: "object",
      properties: {
        file: { 
          type: "string",
          description: "Path to the manifest file or URL"
        },
        namespace: { 
          type: "string",
          description: "The namespace to apply to (optional, defaults to current context namespace)"
        }
      },
      required: ["file"]
    }
  • server.js:1392-1394 (registration)
    Generic registration handler for listing all tools, including 'apply', by returning the static 'tools' array containing its schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thekaranpargaie/kube-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server