Skip to main content
Glama

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
NameRequiredDescriptionDefault
namespaceNoThe namespace to list roles from (optional, defaults to current context namespace)

Implementation Reference

  • 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)" } } } },
  • 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)" } } }

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