list-namespaces
Retrieve all namespaces in a Kubernetes cluster to view available environments and organize resource management.
Instructions
List all Kubernetes namespaces
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:1433-1439 (handler)Handler for the 'list-namespaces' tool: executes 'kubectl get namespaces -o wide' and returns the stdout 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" }] }; }
- server.js:61-67 (schema)Tool definition including name, description, and empty input schema for 'list-namespaces'.name: "list-namespaces", description: "List all Kubernetes namespaces", inputSchema: { type: "object", properties: {} } },
- server.js:1392-1394 (registration)Registration of all tools list via ListToolsRequestHandler, which returns the 'tools' array containing 'list-namespaces'.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });