list-roles
List Kubernetes roles in a specified namespace to manage access permissions and security policies within your cluster.
Instructions
List Kubernetes roles in a namespace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| namespace | No | The namespace to list roles from (optional, defaults to current context namespace) |
Implementation Reference
- server.js:1923-1931 (handler)The execution handler for the 'list-roles' tool. It extracts the optional namespace from arguments, constructs a kubectl command to list roles with wide output, executes it using execAsync, and returns the stdout as text content or 'No roles found' if empty.case "list-roles": { const { namespace } = args || {}; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl get roles ${nsArg} -o wide`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || "No roles found" }] }; }
- server.js:822-833 (registration)The tool registration object for 'list-roles', included in the tools array returned by ListToolsRequestSchema handler. Defines the tool name, description, and input schema with optional namespace parameter.name: "list-roles", description: "List Kubernetes roles in a namespace", inputSchema: { type: "object", properties: { namespace: { type: "string", description: "The namespace to list roles from (optional, defaults to current context namespace)" } } } },
- server.js:824-832 (schema)The input schema for the 'list-roles' tool, defining an optional 'namespace' string parameter.inputSchema: { type: "object", properties: { namespace: { type: "string", description: "The namespace to list roles from (optional, defaults to current context namespace)" } } }