list-namespaces
Lists all Kubernetes namespaces to help users identify and manage cluster resources through AI assistants.
Instructions
List all Kubernetes namespaces
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list-namespaces"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.js:1433-1439 (handler)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" }] }; } - server.js:60-67 (schema)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 }; });