clusterrole_list
Retrieve and list all ClusterRoles in a Kubernetes cluster by specifying the context name. Enables efficient management and oversight of ClusterRole details.
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 clusterrole_list tool handler: lists all ClusterRoles in the Kubernetes cluster using the RBAC API for the specified context. Registered via @mcp.tool() decorator.@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