Skip to main content
Glama

list-namespaces

Lists all Kubernetes namespaces to help users identify and manage cluster resources through AI assistants.

Instructions

List all Kubernetes namespaces

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list-namespaces' tool within the CallToolRequestSchema handler. It executes the kubectl command to list all namespaces and returns the output as text content.
    case "list-namespaces": {
      const cmd = `kubectl get namespaces -o wide`;
      const { stdout } = await execAsync(cmd);
      return {
        content: [{ type: "text", text: stdout || "No namespaces found" }]
      };
    }
  • The schema definition for the 'list-namespaces' tool in the tools array, specifying name, description, and empty input schema (no parameters required).
    {
      name: "list-namespaces",
      description: "List all Kubernetes namespaces",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • server.js:1392-1394 (registration)
    Registration of the ListToolsRequestSchema handler that returns the full list of tools, including 'list-namespaces'.
    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