clusterrole_list
List all ClusterRoles in a Kubernetes cluster to manage role-based access control permissions across namespaces.
Instructions
List all ClusterRoles in the cluster.
Args: context_name: The Kubernetes context name
Returns: List of ClusterRole basic information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_name | Yes |
Implementation Reference
- tools/role.py:94-109 (handler)The handler function for the 'clusterrole_list' tool. It lists all ClusterRoles in the Kubernetes cluster using the RBAC API, decorated with @mcp.tool() for registration and execution.@mcp.tool() @use_current_context def clusterrole_list(context_name: str): """ List all ClusterRoles in the cluster. Args: context_name: The Kubernetes context name Returns: List of ClusterRole basic information """ rbac_v1: RbacAuthorizationV1Api = get_api_clients(context_name)["rbac"] clusterroles = rbac_v1.list_cluster_role() result = [{"name": clusterrole.metadata.name} for clusterrole in clusterroles.items] return result